#include<stdio.h>

int sum=0;

int main(){
  int i,n,q,s[100000],t[50000];
  int left=0,right,mid;
  
  scanf("%d",&n);
  
  for(i=0;i<=n-1;i++){
    scanf("%d",&s[i]);
  }
  
  scanf("%d",&q);
  
  for(i=0;i<=q-1;i++){
    scanf("%d",&t[i]);
  }


  for(i=0;i<=q-1;i++){
    left=0;
    right=n;
    while(left<right){
      mid=(left+right)/2;
      if(t[i]==s[mid]){
	sum++;
	break;
      }
      else if(t[i]>s[mid])left=mid+1;
      else if(t[i]<s[mid])right=mid;
    }
  }

  printf("%d\n",sum);

  return 0;
}
  
      
  
  
  

  

