180. Inversions
time limit per test: 0.50
sec.
memory limit per test: 4096
KB
input: standard
output: standard
There are N integers (1<=N<=65537) A1, A2,.. AN (0<=Ai<=10^9). You need to find amount of such pairs (i, j) that 1<=i<j<=N and A[i]>A[j].
Input
The first line of the input contains the number N. The second line contains N numbers A1...AN.
Output
Write amount of such pairs.
Sample test(s)
Input
5
2 3 1 5 4
Output
3
| Author: | Stanislav Angelyuk
|
| Resource: | Saratov ST team Spring Contest #1
|
| Date: | 18.05.2003
|
| Server time: 2010-09-03 22:48:30 | Online Contester Team © 2002 - 2010. All rights reserved. |
|
|