#ds504. 重复的数
重复的数
Repeated Numbers
Problem Description
Given a sequence and several queries. Each query asks: in the interval , how many numbers appear exactly times?
Input Format
The first line contains one integer , the length of the sequence.
The second line contains integers , the elements of the sequence.
The third line contains one integer , the number of queries.
The following lines describe the queries; the -th line contains three integers $l_i, r_i, k_i\ (1 \le l_i < r_i \le n,\ 1 \le k_i \le n)$, asking how many numbers in appear exactly times.
Output Format
Output lines, each the answer to the corresponding query.
Sample Input
3
1 2 2
5
1 1 1
1 1 2
1 2 1
1 2 2
1 3 2
Sample Output
1
0
2
0
1