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

int main() {
  int n, q;
  cin >> n;

  vector<int> a(n);
  for (int i = 0; i < n; ++i)
    cin >> a[i];

  cin >> q;
  for (int i = 0; i < q; ++i) {
    int b, e, k;
    cin >> b >> e >> k;

    int cnt = 0;
    for (int j = b; j < e; ++j)
      if (a[j] == k)
        ++cnt;
    cout << cnt << endl;
  }
}
