#include <stdio.h>

#define SMAX 100000
#define TMAX 50000

int main(void)
{
  

int i=0,j=0,n,q,count=0;
  int S[SMAX],T[TMAX];
  
  scanf("%d",&n);
 
  while(i < n){
    scanf("%d",&S[i]);
    i++;
  }
  
  scanf("%d",&q);

  
  while(j < q ){
  scanf("%d",&T[j]);
  j++;
  }

 int left = 0; 
    int right = n; 
    int mid; 


      for(j=0;j < q;j++){
	for(i =0;i < n;i++){
        mid = (left + right) / 2; 
        if (left <= right) {
	  if(T[j]==S[i]){
	  count++;
	  break;
	  }
        }
	else if (T[mid] < S[i]) {
            left = mid + 1; 
        }
	else {
            right = mid;
        }
	}
      }

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