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