#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
long long buffer[500001];
long long n;
long long find(long long start, long long end, long long temp){
if (start == end) return 0;
long long middle = (start + end) /2;
if (buffer[middle] == temp){
return 1;
}else if (temp < buffer[middle]){
return find(start, middle, temp);
}else {
return find(middle+1,end,temp);
}
}
int main() {
cin.tie(NULL);
ios::sync_with_stdio(false);
cin >> n;
for (auto i=0; i<n; i++){
cin >> buffer[i];
}
sort(buffer, buffer+n);
long long m;
cin >> m;
for (auto i=0; i<m; i++){
long long temp;
cin >> temp;
cout << find(0, n,temp) << ' ';
}
return 0;
}