This is the so-called matching problem, in which

individuals mix their hats up and then randomly make a selection. The random variable

is the number of individuals that select their own hat. The permutations that lead to

are called derangements. The distribution of

is given by

,

. Both the expectation and the variance of

equal 1, regardless of the value of

. As

goes to infinity, the distribution of

converges to the Poisson distribution with parameter 1.