题目描述
Given are three sequences of length $N$ each: $A = (A_1, A_2, \dots, A_N)$, $B = (B_1, B_2, \dots, B_N)$, and $C = (C_1, C_2, \dots, C_N)$, consisting of integers between $1$ and $N$ (inclusive).
How many pairs $(i, j)$ of integers between $1$ and $N$ (inclusive) satisfy $A_i = B_{C_j}$?
### Constraints
- $1 \leq N \leq 10^5$
- $1 \leq A_i, B_i, C_i \leq N$
- All values in input are integers.