Number of Ways to Wear Different Hats to Each Other
Process hats one at a time with a bitmask of the people already wearing one, so every hat is used at most once.
Process hats one at a time with a bitmask of the people already wearing one, so every hat is used at most once.