//http://vivi.dyndns.org/tech/cpp/list.html#insert
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;

/*auto count_a(auto b, auto e, auto k, auto a)
{
    auto count_a = count(a.begin() + b, a.begin() + e, k); //size_t
    return count_a;
}*/

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

    return 0;
}
