Every season at the tannery row of Leatherwick, someone must approve the repair estimates. This year the task falls to Rhea, armed only with the shelves register. Task: Print the number of inversions: index pairs (i,j) with i<j but a[i] > a[j]. Input format: First line: n. Second line: n integers. Output format: Print the inversion count (fits 64-bit). Constraints: 1 <= n <= 2141; 0 <= a[i],x <= 1000000.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= n <= 2141; 0 <= a[i],x <= 1000000.
