#include <stdio.h>

int main(){
  int x,y,i,j,k,key,res=0,same[500],A[10000+1];

  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[j],key)==1)res++;
  }


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

int Lsearch(int B[],int n,int kkey){
  int i;
  B[n]=kkey;
  while(B[i]!=kkey) i++;
  return i!=n;
}