The answer would be 10! if there were no restrictions. If the hats were: A B C D E F G H I J and there were no restrictions they could be arranged in 10! ways From that 10! we must subtract the number of non-allowable ways. Suppose the red hat is hat A and the black hat is hat B. Then we must subtract the 9! ways they could be arranged with hat A and hat B together, with hat A left of B: AB C D E F G H I J And we must also subtract the 9! ways they could be arranged with hat A and hat B together, with hat B left of hat A: BA C D E F G H I J Answer: 10! - 2*9! = 3628800 - 2*(362880) = 2903040 Edwin