using merge sort to count the invert numbers