#include<stdio.h>
#define N 10000
#define Q 500

int search();
int n,S[N],q,T[Q];

int main(){
  int i,j;

  //input
  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]);
  }

  //seach
  printf("%d\n", search());
  
  return 0;
}

int search(){
  int left,right,mid,key;
  int i;
 
 for(i=0 ; i<q ; i++){
   left=0;
   right=n;
   key=T[i];
   
   while(left<right){
     mid=(left + right)/2;
     
     if(key ==  S[mid])
       return mid+1;
     
     else if(key > S[mid])
       left = mid+1;
     
     else if(key < S[mid])
       right=mid;
   }
 }
}