#include <bits/stdc++.h>
using namespace std;
long long numbers[1000000];
long long lb(int firstIndex, long long lastIndex, long long wanted) {
while(firstIndex!=lastIndex) {
long long midIndex = (firstIndex + lastIndex)/2;
if(numbers[midIndex]<wanted) {
firstIndex = midIndex+1;
} else {
lastIndex = midIndex;
}
}
return lastIndex;
}
long long ub(long long firstIndex, long long lastIndex, long long wanted) {
while(firstIndex!=lastIndex) {
long long midIndex = (firstIndex + lastIndex)/2;
if(numbers[midIndex]<=wanted) {
firstIndex = midIndex+1;
} else {
lastIndex = midIndex;
}
}
return lastIndex;
}
long long instanceCounter(long long firstIndex, long long lastIndex, long long wanted) {
return ub(firstIndex, lastIndex, wanted) - lb(firstIndex, lastIndex, wanted);
}
int main() {
long long numberCount;
cin>>numberCount;
for(int i = 0; i<numberCount; i++) {
cin>>numbers[i];
}
long long questionCount;
long long curQuestion;
cin>>questionCount;
for(long long i = 0; i<questionCount; i++) {
cin>>curQuestion;
cout<<instanceCounter(0, numberCount, curQuestion)<<endl;
}
return 0;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}