add inversions counter