#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>

using namespace std;

int main() {
    ios :: sync_with_stdio(false);
    int n, q;
    int a[100001], t;

    cin>>n;
    for(int i=0; i<n; ++i) {
        cin>>a[i];
    }
    cin>>q;
    for(int i=0; i<q; ++i) {
        cin>>t;
        cout<<binary_search(a, a+n, t)<<endl;
    }
    return 0;
}
