I have been struggeling for some time with the following exercise from a book in discrete mathematics. It is an inclusion-exclusion principle exercise.

How many permutations of 1, 1, 2, 2, 3, 3, 4, 4, 5, 5 are there in which no two adjacent numbers are equal?

I have come thus far:

Let S be the set of all permutations of 1, 1, 2, 2, 3, 3, 4, 4, 5, 5. Let $P\_{i}$ be the property: pattern $ii$ occurs, for $i ≤ 5$. Then $|S|=(2!)^{5}$. I divide by $(2!)^{5}$ to not overcount the cases where two equal numbers come one after the other. There are 4 such cases.

$|S|-\sum\_{i<j}N(i,j)+\sum\_{i<j<k}N(i,j,k)-\sum\_{i<j<k<l}N(i,j,k,l)+\sum N(1,2,3,4,5)$

Let $N(i)$ be the number of members of $S$ having property $P\_{i}$. Then $N(1)=N(2)=N(3)=N(4)=N(5)=\frac{9!}{(2!)^{4}}$. There are 9 choices for placing i.e. $11$ in a permutation. The remaining eigth numbers may be permuted in 8! ways. I divide by $(2!)^{4}$ not to overcount the cases where two equal numbers are adjacent. Which one comes first doesn't matter.

When it comes to each $N(i,j)$ etc. I get stuck. The solution says $N(i,j)=\frac{8!}{2^3}$ but I don't understand why.