count inversions in a list- first brute force algorithm