
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin>>n;
    unordered_map<int,int> mp;
 for(int i=0;i<n;i++){
  int temp; cin>>temp;
  mp[temp]++;

}
int q; cin>>q;
 while(q--){
     

   int f; cin>>f;
 cout<<mp[f]<<endl;
   
   
}
}
