MergeSort updated with inversion count