#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int a[111111];
int main() {
	int n, q;
	cin >> n;
	rep(i, n)cin >> a[i];
	cin >> q;
	while (q--) {
		int k;
		cin >> k;
		cout << binary_search(a, a + n, k) << endl;
	}
	return 0;
}
