# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

# Count the Chaos

By · Limits 1s, 512 MB

Imagine, you have an array of integers of size $N$. At each index of this array is a unique integer from 1 to $N$. You have to calculate how many pairs of indexes $(i, j)$ exists in the array such that:

1. $i < j$
2. $A[i] > A[j]$

## Input

The first line contains a positive integer $N$ ($1 \le N \le 10^5$), the size of the array.

The next $N$ lines have one number each, the content of the index i in the array.

## Output

Output a single number, the result of this problem.

## Sample

InputOutput
2
1 2
0

### Statistics

60% Solution Ratio

RabeyaEarliest, Sep '19

nfs277Fastest, 0.0s

RabeyaLightest, 131 kB

rifat_246Shortest, 224B