let N = Int(readLine()!)!
let A = readLine()!.split(separator: " ").map{ Int(String($0))! }.sorted()
let M = Int(readLine()!)!
let targets = readLine()!.split(separator: " ").map{ Int(String($0))! }
var answer = ""
for target in targets {
var start = 0
var end = A.count - 1
var isFound = false
while start <= end {
var mid = (start + end) / 2
if target < A[mid] {
end = mid - 1
} else if target > A[mid] {
start = mid + 1
} else {
isFound = true
break
}
}
answer += "\(isFound ? 1 : 0)\n"
}
print(answer)