Added inversion counter