#include <iostream>
using namespace std;
int x[1000], y[1000], i, j, n, m, gasit;
int main()
{
cin >> n;
for (i=0; i<n; ++i)
cin >> x[i];
cin >> m;
for (i=0; i<m; ++i)
cin >> y[i];
for (j=0; j<m; ++j)
{
gasit=0;
for (i=0; i<n; ++i)
{
if (y[j]==x[i]) { gasit=1; break; }
}
if (gasit) cout << 1;
else cout << 0;
cout << " ";
}
}