#include <stdio.h>
int linerSearch (int, int, int *, int *);
#define N 10000
  
int main (){
  int n,m,a[N],k,l,b[N],i,ans;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&m);
    a[i]=m;
  }
  scanf("%d",&k);
  for(i=0;i<k;i++){
    scanf("%d",&l);
    b[i]=l;
  }
  /*for(i=0;i<n;i++){
    printf("%d",a[i]);
  }
  printf("\n");
    for(i=0;i<n;i++){
    printf("%d",b[i]);
    }*/
  
    ans=linerSearch(k,n,a,b);
    printf("%d\n",ans);
  return 0;
}

int linerSearch(int k, int n, int a[],int b[]){
  int i,j;
  int count = 0;
  for(i=0;i<k;i++){
    for(j=0;j<n;j++){
      if(b[i]==a[j]){
	count++;
	break;
      }
    }
  }
  return count;
}

