add count inversions