I need help with one of my chem questions for homework.

In the ground state of Mercury, Hg,
a) How many electrons occupy atomic orbitals with n=3?
b) How many electrons occupy d atomic orbitals?
c) How many electrons occupy Pz atomic orbitals?
d) How many electrons have spin "up" (m= + 1/2)?

I know the answers for the question are:
a) 18
b) 30
c) 10
d) 40

But how do you get those?? I'm very confused and have no idea as to how we solve/find out this!! Please help