Answer
See the answer below.
Work Step by Step
Assuming $0\leq L\leq N$
There are $N+1$ subshells per shell and 3 orbitals per subshell (-1 ,0 and 1), so for the first three:
$(2+3+4)×3=27$
If on the other hand $L=N$
There is 1 subshell per shell and 3 orbitals per subshell, so for the first three:
$3×3=9$