merge sort and inversions