n=int(input())
cards=set(map(int,input().split()))

m=int(input())
targets=map(int,input().split())

for t in targets:
    if t in cards:
        print(1, end=' ')
    else:
        print(0, end=' ')

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: