Explore how to count inversions in an array using merge sort, a vital technique in sorting algorithms.