Count Inversion Leetcode Problem 142