# | Problem | Pass Rate (passed user / total user) |
---|---|---|
13742 | DS_2022_Quiz5_Sort |
|
Description
Given an array A of integers. Please find the number of pairs <A[i], A[j]> in A that satisfy the following conditions.
- i < j
- A[i] > A[j]
For example, we can find that <4,2>, <6,2>, <9,2> satisfy conditions.
Input
Each test case begins with a line containing an integer N, which is the size of the array.
The next line contains N integers, which denote the elements of the array.
Please note:
- 0 ≤ N ≤ 1,000,000
- -231 ≤ array element ≤ 231.
Output
Print the number of pairs <A[i], A[j]> in A that satisfy those conditions. A newline is added after the answer.