The correct domain consists of only five integers: {0, 1, 2, 3, 4} It's possible that the customer buys NO melons; that's why we have that 0 in the domain. No customer may buy more than 4 melons; that's why the domain does not include numbers greater than 4. Only whole melons are sold, which is why the domain contains no fractions, no mixed numbers.
There are 6! ways to arrange the hats. The number of ways for which no guest will receive the proper hat is 5! (since there are 5 wrong hats for the first guest, 4 for the second guest, and so on). The probability that no guest will receive the proper hat is: