#include<stdio.h>
#define NOT_FOUND -1
int binarySearch(int key);
int i,a[100000],b[50000],n,q,c=0;

int main()
{

  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&b[i]);
    if(binarySearch(b[i])!=NOT_FOUND)
      c++;
  }
  printf("%d\n",c);
  return 0;
}




int binarySearch(int key){
  int left = 0;
  int right = n;
  int mid;  
  while (left < right){
    mid = (left + right) / 2;
    if (a[mid] == key)
      return mid;
    else if (key < a[mid])
      right = mid;
    else{
      left = mid + 1;
    
    }
      
  }

  return NOT_FOUND;
  
}

