Implemented inversion count