You are given an array of n integers. Count the number of index pairs (i, j) with i < j and nums[i] == nums[j].
If a value occurs f times, it contributes f * (f - 1) / 2 such pairs; the total is the sum over all values.
Input format
Line 1: an integer n.
Line 2: n space-separated integers, the array.
Output format
A single integer: the number of equal-value index pairs.
Constraints
- 1 <= n <= 100000
- -1000000000 <= each value <= 1000000000