Morning light hits the honeycomb cliffs of Beeswick as Theo unrolls the day's manifest of ledgers. The tally will decide the next shipment. 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 <= 2260; -1000000 <= a[i],x <= 1000000000.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= n <= 2260; -1000000 <= a[i],x <= 1000000000.
