#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
bool binary_search(vector<int> &numbers, int size, int target) {
int min = 0, max = size - 1;
while (min <= max) {
int mid = (min + max) / 2;
if(target == numbers[mid]) return true;
if(target < numbers[mid]) {
max = mid - 1;
} else {
min = mid + 1;
}
}
return false;
}
int main(){
vector<int> nums;
vector<int> target_nums;
int X;
scanf("%d", &X);
for(int i = 0; i < X; i++) {
int A;
scanf("%d", &A);
nums.push_back(A);
}
int Y;
scanf("%d", &Y);
for(int i = 0; i < Y; i++) {
int A;
scanf("%d", &A);
target_nums.push_back(A);
}
sort(nums.begin(), nums.end());
for (int i = 0; i < target_nums.size(); i++) {
bool isDuplicate = binary_search(nums, nums.size(), target_nums[i]);
printf("%d\n", isDuplicate);
}
}