Ten students are standing in a line. A teacher wants to place a hat on each student. He has two colors of hats, red and white, and he has $10$ hats of each color. Determine the number of ways in which the teacher can place hats such that among any set of consecutive students, the number of students with red hats and the number of students with blue hats differ by at most $2$