Count Inversion Leetcode Problem 704