#include<stdio.h>

int main(void) {
  
  int cnt=0,key,i,left,right,mid,num1[100000],num2[100000],n,m;
  
  scanf("%d",&n);
  for(i=0;i<n;i++) 
    scanf("%d",&num1[i]);
  
  scanf("%d",&m);
  for(i=0;i<m;i++)
    scanf("%d",&num2[i]);
  
  for(i=0;i<m;i++) {
    right = n;
    left = 0;
    key = num2[i];
    
    while(left < right) {
      mid = (left + right)/2;
      
      if(num1[mid] == key){
	cnt++; 
	break;
      }
      else if(num1[mid] < key) { 
	left  = mid + 1;
      }
      
      else { 
	right = mid ;
      }
    }
  }
  printf("%d\n",cnt);
  
  return 0;
} 