Consider an array of integers, . Find and print the total number of pairs such that where .
Input Format
The first line contains an integer, , denoting the number of elements in the array.
The second line consists of space-separated integers describing the respective values of .
Constraints
Scoring
- for of the test cases.
- for of the test cases.
- for of the test cases.
Output Format
Print a long integer denoting the total number pairs satisfying where .
Sample Input
5
1 1 2 4 2
Sample Output
8
Explanation
There are eight pairs of indices satisfying the given criteria: , , , , , , , and . Thus, we print as our answer.