#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    vector<int> A;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        A.push_back(a);
    }
    int q;
    cin >> q;
    for (int i = 0; i < q; i++)
    {
        int b, e, k;
        cin >> b >> e >> k;
        cout << count(A.begin() + b, A.begin() + e, k) << endl;
    }
}
