Number of inversions#4261

Number of inversions

1 second
128 megabytes
Easy (≈1000)

Write a program that finds for a given array A = \langle a_1, a_2, \ldots, a_n \rangle the number of such pairs that i < j and a_i > a_j.

Input

The first line contains the number of array elements (1 \le n \le 50000). Second line contains different elements of array - nonnegative integers, not greater than 10^6.

Output

Print the number of required pairs.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading