Prove the following Lemma and you will know how to count inversion using merge sort.

Lemma: The number of inversion in array A[1..n] equals the number of inversion in array A[1..m] plus the number of inversion in array A[m+1..n] plus the number of inversion in array Sort(A[1..m]) + Sort(A[m+1..n]).