#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vl vector<ll>
#define pl pair<ll,ll>
#define rep(i,b) for(ll i=0;i<b;i++)
#define all(v) (v).begin(),(v).end()

int main() {
    ll n,q,b,l,r;
    cin>>n;
    set<ll> a;
    rep(i,n){
        cin>>l;
        a.insert(l);
    }
    cin>>q;
    rep(i,q){
        cin>>b;
        if(a.find(b)!=a.end())cout<<1<<endl;
        else cout<<0<<endl;
    }
}
