#include <bits/stdc++.h>
using namespace std;

int main()
{
    vector<int> v;
    int n, x, q, a, b, c;
    cin >> n;
    while (n--)
    {
        cin >> x;
        v.push_back(x);
    }
    cin >> q;
    while (q--)
    {
        cin >> a >> b >> c;
        cout << (count(v.begin() + a, v.begin() + b, c)) << endl;
    }
}
