Calculating the oxidation state of nitrogen in given molecules;
Oxidation state of N in NH3 is x+3×(+1)=0 or x=−3
Oxidation state on N in NaNO3 is 1+x+3×(−2)=0 or x=+5
Oxidation state of N in NaN3 is +1+3x=0 or x=−31
Oxidation state of N in Mg3N2 is 3×2+2x=0 or x=−3
Thus 3 molecules (i.e. NH3,NaN3 and Mg3N2, have nitrogen in negative oxidation state