#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
typedef long long ll;
int main(void)
{
	int n, q, a, b, e, k;
	cin >> n;
	vector<int> A;
	rep(i, n)
	{
		cin >> a;
		A.push_back(a);
	}
	cin >> q;
	rep(i, q)
	{
		cin >> b >> e >> k;
		cout << count(A.begin() + b, A.begin() + e, k) << endl;
	}
}
