Count the number of Inversions