#include<stdio.h>
#include<stdlib.h>

int BinarySearch(int *,int);

int n;

int main()
{
  int q,C;
  int *S;
  int *T;
  int i;

  // printf("n\n");
    scanf("%d",&n);
  S = (int *)malloc( n * sizeof(int));
  // printf("S\n");
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  // printf("q\n");
  scanf("%d",&q);
  T = (int *)malloc( q * sizeof(int));
  // printf("T\n");
  for(i=0;i<q;i++){
    //printf("i=%d\n",i);
    scanf("%d",&T[i]);
  }

  for(i=0;i<q;i++){
    C += BinarySearch(S,T[i]);
  }

  printf("%d\n",C);
  
  free(S);
  free(T);

  return 0;
}

int BinarySearch(int *S,int key)
{
  int left=0,right=n,mid;

  while(left < right){
    mid = (left + right)/2;
    if(S[mid] == key){
      return 1;
    }
    else if(key < S[mid]){
      right = mid;
    }
    else {
      left = mid + 1;
    }
  }

  return 0;
}
	
  
  

