#include <stdio.h>

int A[10000];
int n;

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

  int i,n2,keyword,judge=0;

  scanf("%d",&n);
    for(i=0;i<n;i++){
      scanf("%d",&A[i]);
    }
  
    scanf("%d",&n2);
      for(i=0;i<n2;i++){
	scanf("%d",&keyword);
      
     
    if(binarySearch(keyword))
      {
	judge++;
      }
      }
    printf("%d\n",judge);
    return 0;
}