Sample code to count the number of inversions in an array of integers.