Finding Number Of Permutation Reverses

What is the easiest way to count the number of opposite order in permutation.
meaning the total of elements in the permutation where $i<j$ and $\sigma_i>\sigma_j$

For example, $3142$, we have $31, 32, 42,$ so $OO(3142)=3$.

• There is only one way to count, and that is by... counting. So the easiest way (which also the hardest way) to count them is by... well... counting them. – barak manos Mar 22 '15 at 11:24
• Note that this quantity is sometimes called the disorder of a permutation. – Gerry Myerson Mar 22 '15 at 11:53
• It is also used to determine the parity of permutation – gbox Mar 22 '15 at 11:56