added inversion counts
Added Inversion calculations