#include<stdio.h>
 
 
int main(void){
 int flag = 1;
int i,j,N,v,S[10000],T[10000],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", &T[i]);
}
 

while (flag) {
       flag=0;
        for ( j = 0 ; j <N&&flag==0; j++ ) {
            if ( T[i] == S[j] ) {
                
               flag=1;
                
c++;
            }
        }
    }
 
    

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