For the permutation $\begin{pmatrix}5&2&4&3&6&1\\4&1&3&2&6&5\end{pmatrix}$, determine if it is even based on its inversions.
So here's my trouble; I've worked out the inversions for the top row as $(5,2),(5,4),(5,3),(5,1),(2,1),(4,3),(4,1),(6,1)$ for a total of $8$ and for the bottom row $(4,1),(4,2),(4,3),(3,2),(6,5)$ for a total of $5$.
This sums to 13 inversions for the permutation making it odd? My understanding is that I look at a number and see how many smaller numbers are to the right, each pair forms an inversion ie. $(5,2)$ from the top row.
Can anyone shed some light on this? Is there some double-counting rule I'm missing