added inversion count