#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
	int n;

	cin >> n;

	int A[n];
	int q, b, e, k;
	int count;

	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}

	cin >> q;

	for (int i = 0; i < q; i++) {
		cin >> b >> e >> k;
		count = 0;

		for (int j = b; j < e; j++) {
			if (A[j] == k) count++;
		}
		cout << count << endl;
	}
}


