{"raw_statement":[{"iden":"problem statement","content":"You are given a sequence of length $N$: $A=(A_1,\\ldots,A_N)$.\nAnswer $Q$ queries given in the following format.\n\n*   You are given integers $L$, $R$, and $X$. Find the number of elements among $A_L, \\ldots, A_R$ whose values are equal to $X$."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 2\\times 10^5$\n*   $1 \\leq A_i \\leq N$\n*   $1 \\leq Q \\leq 2\\times 10^5$\n*   $1\\le L \\leq R \\leq N, 1 \\leq X \\leq N$, for each query.\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ \n$A_1$ $A_2$ $\\ldots$ $A_N$\n$Q$\n$\\mathrm{Query}_1$\n$\\mathrm{Query}_2$\n$\\vdots$\n$\\mathrm{Query}_Q$\n\nHere, $\\mathrm{Query}_i$ represents the $i$\\-th query.\nEach query is in the following format:\n\n$L$ $R$ $X$"},{"iden":"sample input 1","content":"5\n3 1 4 1 5\n4\n1 5 1\n2 4 3\n1 5 2\n1 3 3"},{"iden":"sample output 1","content":"2\n0\n0\n1\n\nIn the first query, two of $(A_1,A_2,A_3,A_4,A_5) =(3,1,4,1,5)$ have values equal to $1$.\nIn the second query, zero of $(A_2,A_3,A_4) =(1,4,1)$ have values equal to $3$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}