
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
int[] nums = Arrays.stream(br.readLine().split(" "))
.mapToInt(Integer::parseInt)
.toArray();
Arrays.sort(nums);
int M = Integer.parseInt(br.readLine());
int[] check = Arrays.stream(br.readLine().split(" "))
.mapToInt(Integer::parseInt)
.toArray();
int[] result = new int[M];
for(int i=0; i<M; i++) {
int num = check[i];
int mid = (nums.length / 2);
if(num >= nums[mid]) {
for(int j=mid; j<nums.length; j++) {
if(nums[j] == num) {
result[i] = 1;
break;
}
}
} else {
for(int j=mid-1; j>=0; j--) {
if(nums[j] == num) {
result[i] = 1;
break;
}
}
}
}
for(int re:result) {
System.out.println(re);
}
}
}