#include<iostream>
#include<algorithm>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
long long arr[100000];
int num;
cin>>num;
for(int i=0;i<num;i++){
cin>>arr[i];
}
sort(arr, arr+num);
int n;
cin>>n;
for(int i=0;i<n;i++){
int ans;
cin>>ans;
bool check = false;
long long s = 0;
long long e = num-1;
while(s<=e){
long long mid = (s+e)/2;
if(arr[mid] == ans){
check = true;
break;
}else if(arr[mid]<ans){
s = mid+1;
}else{
e = mid-1;
}
}
cout<<check<<"\n";
}
}