1743 What Is FB


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 32M

Problem types
Allowed languages
C, C++, Java, Python

Description

give you an integer array A, which contains N integers. calculate the sum of f[i]. f[i] means the number of integers strictly less than A[i] in A.

come on! first blood!!

Input

several cases. for each case, first an integer N, then N integers. (1<=N<=1000)

Output

sum of f[i]

Sample

Input

3
1 2 3
4
1 2 3 2

Output

3
5

Source: zjut_DD


Comments

There are no comments at the moment.