inversion counter