Count Inversion Leetcode Problem 23