Count inversions - removed logging