#define MAX 1000
int linerSearch(int*, int, int);
int n;

main()
{
  int s[MAX], t[MAX];
  int i, q;
  
  scanf("%d", &n);
  for(i=0; i<n; i++){
	scanf("%d", &s[i]);
  }

  scanf("%d", &q);
  for(i=0; i<q; i++){
	scanf("%d", &t[i]);
  }
  
  for(i=0; i<q; i++){
	linerSearch(s, n, t[i]);
	  }
  
  return 0;
}

int linerSearch(int *A, int n, int key)
{
  int i=0, count=0;
  A[n] = key;
  
  while(A[n] != key){
	i++;
  }
  if(i!=n) count++;  
  printf("%d\n", count);
}