Finding inversions in O(n logn) time

Not the "cleanest" (method-global inversion var) imperative solution or fastest (still could use array-copy), but something that was coded in rush and works.