#include<stdio.h>
#define S 1000
#define T 500
int linearSearch(int s[S],int t);
int n,q;
int count=0;
int main(){
  int i,j,k,ans;
  int s[S],t[T];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&s[i]);
}
  scanf("%d",&q);
  for(j=0;j<q;j++){
    scanf("%d",&t[j]);
  }
  for(k=0;k<q;k++){
 if(linearSearch(s,t[k])==1){
 count++;}
  }
  printf("%d\n",count);
  return 0;
}


int linearSearch(int s[S],int t){
  int i=0;
 s[n] = t;
 while(s[i]!=t){
 i++;}
  return i!=n;
}
