If there are men and hats. The probability that men select there own hat is:

Where, is the probability that no matches occur.

For your case, extend the number of hats to and let to be then to be Now take minus the sum of your values for and

Hope this helps.

Anonymous