#include <bits/stdc++.h>
using namespace std;
int main() {
int n,q;
cin>>n;
vector<int>v(n);
for(int i=0;i<n;i++)
cin>>v[i];
sort(v.begin(),v.end());
cin>>q;
while(q--)
{
int y;
cin>>y;
int c=lower_bound(v.begin(),v.end(),y)-v.begin();
int d=upper_bound(v.begin(),v.end(),y)-v.begin();
cout<<d-c<<"\n";
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKICAgIGludCBuLHE7CiAgICBjaW4+Pm47CiAgICB2ZWN0b3I8aW50PnYobik7CiAgICBmb3IoaW50IGk9MDtpPG47aSsrKQogICAgICAgIGNpbj4+dltpXTsKICAgIHNvcnQodi5iZWdpbigpLHYuZW5kKCkpOwogICAgY2luPj5xOwogICAgd2hpbGUocS0tKQoJewoJCWludCB5OwoJCWNpbj4+eTsKCQlpbnQgYz1sb3dlcl9ib3VuZCh2LmJlZ2luKCksdi5lbmQoKSx5KS12LmJlZ2luKCk7CgkJaW50IGQ9dXBwZXJfYm91bmQodi5iZWdpbigpLHYuZW5kKCkseSktdi5iZWdpbigpOwoJCWNvdXQ8PGQtYzw8IlxuIjsKCX0KfQ==