#include<stdio.h>
#include<stdlib.h>
int main(){
  int n1,n2;
  int *A,*B;
  int i,j,count=0;
  int left,right,mid;
   
  scanf("%d",&n1);


   A  = (int *)malloc(n1 * sizeof(int));
   
  for(i=0;i<n1;i++){
    scanf("%d",&A[i]);
  }

  scanf("%d",&n2);

  B  = (int *)malloc(n2 * sizeof(int));
   
    
    for(i=0; i<n2; i++){
      scanf("%d",&B[i]);
    }

    right = n1;
    left =0;


    for(j=0; j<n2; j++){
     for(i=0; i<n1; i++){
       mid = (left + right)/2;
       
       if( B[i] == A[mid]){
	 count++;
	  }
       
       if(B[i] > A[mid]){
	 left = mid +1;
       }
	 else if (B[i] < A[mid]){
	   right =mid;
	 }
     }
    }
	 
	   
    printf("%d\n",count);

    return 0;
}
      

