A bag contains (2n+1) coins. It is known that n of these coins have a head on both sides, whereas the remaining (n+1) coins are fair. A coin is selected at random from the bag and tossed once. If the probability that the toss results in a head is 3142, then n is equal to