Count Inversions in an array, O(n^2) naive solution