To find the total number of allowed states, first, write down the allowed orbital quantum numbers l, and then write down the number of allowed values of ml for each orbital quantum number. Sum these quantities, and then multiply by 2 to account for the two possible orientations of spin.
Quantum states for n=5
l......ml
0 , 0................................1
1 , -1, 0, +1................................ 3
2 , -2, -1, 0, +1, +2................................5
3 , -3, -2, -1, 0, +1, +2, +3................................ 7
4 , -4,-3, -2, -1, 0, +1, +2, +3,+4 ................................9
2*(1+3+5+7+9)=
2*5^2 = 50 allowed states