#include<stdio.h>
   
   int S[1000000],N;
int binarySearch(int v){
int a=0;
int b=N;
int c;
int s[1000000];
while(a<b){
c=(a+b)/2;
if(v==S[c]){
return 1;}
if(v>S[c]){
a=c+1;}
else if(v<S[c]){
b=c;}
}

return 0;

}

int main(void){
  
int i,j,N,v,S[10000],k,q; 
int c =0;
   
    scanf("%d", &N);
     for ( i = 0; i < N; i++ ){ 
scanf("%d", &S[i]);
}
    
 scanf("%d", &q);
     for ( i = 0; i < q; i++ ){ 
scanf("%d", &k);

if(binarySearch(k))
c++;
}

   
  

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