# Sample size to calculate median average for large population

I have a large dataset of individual's forename and birth year. I'd like to know the average birth year of people with different forenames, or more specifically, how many name/year pairs do I need to be 95% confident that the median year for that name is within 1 (or 5) years of the total population with that name.

Example:

There are N=400,000 people called 'Stephen' in the total population and I know the birth year of a random sample S=22,000 of them. The median birth year of the 22,000 is 1968 and standard deviation 10.6.

Can the minimum sample size S necessary to be 95% confident that the median over all of N is within one year of the median over S be expressed in terms of S and N? Or within five years?

Basically I want to know for which names I have a large enough S to say what the median birth year over all of N would be, if I had everyone's birth year. It feels intuitively that the act of taking the median should lead to the sample size being low, but I don't know how to calculate it.

(Successful answerer gets to find out the median birth year corresponding to the name of their choice!!)