#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) rep(i,0,n)

int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n)cin>>a[i];
    int q;
    cin>>q;
    REP(i,q)
    {
        int b,e,k;
        cin>>b>>e>>k;
        vector<int>::iterator ib=a.begin(),ie=a.begin();
        ib+=b;ie+=e;
        cout<<count(ib,ie,k)<<endl;
    }
}
