import std.stdio, std.string, std.array, std.conv, std.algorithm;

void main() {
    int n = readln.chomp.to!int;
    int[] a = readln.chomp.split.to!(int[]);
    int q = readln.chomp.to!int;
    foreach (i; 0 .. q) {
        int[] tmp = readln.chomp.split.to!(int[]);
        int b = tmp[0], e = tmp[1], k = tmp[2];
        a[b..e].count(k).writeln;
    }
}
