#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,a,q,b,e,k;
    cin >> n;
    std::deque<int> deq;
    for (int i=0;i<n;i++) {
        cin >> a;
        deq.emplace_back(a);
    }
    cin >> q;
    int count = 0;
    for (int j=0;j<q;j++) {
        cin >> b >> e >> k;
        for (b;b<e;b++) {
            if ( deq[b]==k) {
                count = count + 1;
            }
        }
        std::cout << count << std::endl;
        count = 0;
    }
}

