The equation which conserves the identity of all the atoms is
N2 + 3H2 = 2NH3. From this equation, one can see that the number of ammonia molecules created is double the number of nitrogen molecules that are on hand to react with hydrogen. Hence, if one starts with 25 x 10^24 molecules of nitrogen, and if all of them are reacted with hydrogen to form ammonia, the number of ammonia molecules formed will be double the number of nitrogen molecules, i.e., it will be 50 x 10^24.
(I assume that the specification of 1024 in the problem statement is a typo, and it was meant to be 1024 )