#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

int main() {
    int n, q, k, b, e;
    cin >> n;
  	int a[n];
  	for (int i = 0; i < n; i++) cin >> a[i];
  	cin >> q;
  	for (int i = 0; i < q; i++)
  	{
        cin >> b >> e >> k;
        cout << count(a+b,a+e,k) << endl;
  	}
	return 0;
}
