Implemented counting inversions in merge sort