cleaning up inversions count