Implementation of merge sort, need to retrofit it to count inversions