count inversions using merge sort technique