Imagine, you have an array of integers of size . At each index of this array is a unique integer from 1 to . You have to calculate how many pairs of indexes exists in the array such that:
The first line contains a positive integer (), the size of the array.
The next lines have one number each, the content of the index i in the array.
Output a single number, the result of this problem.
Input | Output |
---|---|
2 1 2 | 0 |