Merge sort and inversion count problem in nlogn