You are given
N
integers
A1, ..., AN
.
For each of
Q
queries specified in the
L
R
X
format, output the number elements among
A
L, ..., AR
whose values are
X.< /code>
Input
The first line contains an integer N
(1 <= N <= 2·105).
The second line contains N
integers Ai
(1 <= Ai <= N, 1 <= i <= N).
The third line contains a single integer Q
(1 <= Q <= 2·105).
Each of the following Q
lines contains three integers L,
R,
X
( 1 <= L <= R <= N, 1 <= X <= N).
Imprint
Print Q
lines, i
th line contains the answer to the i
th query.
Examples
# |
Input |
Output |
1 |
5
3 1 4 1 5
4
1 5 1
2 4 3
1 5 2
1 3 3
|
2
0
0
1
|