Score : $300$ points
You are given a sequence $a = (a_1, \dots, a_N)$ of length $N$ consisting of integers between $1$ and $N$.
Find the number of pairs of integers $i, j$ that satisfy all of the following conditions:
Input is given from Standard Input in the following format:
$N$ $a_1$ $\ldots$ $a_N$
Print the answer.
4 1 3 2 4
2
$(i, j) = (1, 4), (2, 3)$ satisfy the conditions.
10 5 8 2 2 1 6 7 2 9 10
8