#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    long long arr[100001];
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> arr[i];
    int q;
    cin >> q;
    while (q--) {
        bool key;
        int trash;
        cin >> trash;
        key=binary_search(arr, arr + n, trash);
        if (key)
            cout << "1" << endl;
        else cout << "0" << endl;
    }
}
