int Lsearch(int B,int kkey){

  if(B==kkey) return 1;
  else return 0;
}


int main(){
  int x,y,i,key,res;

  scanf("%d",&x);
  for(i=0;i<x;i++){
    scanf("%d",A[i]);
  }
   scanf("%d",&y);
  for(i=0;i<y;i++){
    scanf("%d",key);
    if(Lsearch(A[i],key)==1){
      res++;
    }

    printf("%d\n",res);
    return 0;
  }
}