Nicky had some 50-cent and 20-cent coins. He had 4 more 50-cent coins than 20-cent coins at first. He exchanged 1/3 of his 50-cent coins for some 20-cent coins such that the total value of the coins remained the same. In the end, the total value of his 50-cent coins was equal to the total value of his 20-cent coins. How many coins did Nicky have at first?