Count Inversion Leetcode Problem 28