Inversions in an unsorted array