import sys
input = sys.stdin.readline
A = int(input())
A_lst = list(map(int, input().split()))
A_lst.sort()
B = int(input())
B_lst = list(map(int, input().split()))
def binSearch(s, e, target):
while s <= e:
m = (s+e) // 2
if A_lst[m] == target:
return 1
elif A_lst[m] > target:
e = m-1
elif A_lst[m] < target:
s = m+1
return 0
for i in B_lst:
print(binSearch(0, A-1, i))