` 1


def half_check(check_num, check_list):
    list_len = len(check_list)
    
    if(list_len == 0):
        return print('0')
    
    index = list_len // 2
    
    if(check_list[index] == check_num):
        return print('1')
    elif(check_list[index] > check_num):
        return half_check(check_num, check_list[:index])
    else:
        return half_check(check_num, check_list[index + 1:])

import sys
input = sys.stdin.readline    

N = int(input())
A = list(map(int, input().split()))
sorted_A = sorted(A)

M = int(input())
M_list = list(map(int, input().split()))

for check_num in M_list:
    half_check(check_num, sorted_A)

'# 코딩 문제 관련 > 파이썬' 카테고리의 다른 글

백준 1654번(python)  (0) 2020.07.27
백준 10816번(python)  (0) 2020.07.19
백준 2261번(python)  (1) 2020.07.17
백준 6549번(python)  (0) 2020.07.13
백준 2749번(python)  (0) 2020.07.12