#include <iostream>
#include <algorithm>
using namespace std;

int main(void){
    int n,q;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    cin>>q;
    int x,y,z;
    while(q--){
        cin>>x>>y>>z;
        cout<<count(a+x,a+y,z)<<endl;
    }
}
