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

#define K 1000000000

int search(int A[],int n, int key){
  int i=0;
  A[n] = key;
  while(A[i] != key)i++;
  return i!=n  ;
  
}

int main(){
 
  int N,i,*A,*B,M,count=0;
  
  scanf("%d",&N);
  A = (int *)malloc(N * sizeof(int));
  for(i=0;i<N;i++)
  scanf(" %d",&A[i]);
  
  scanf("%d",&M);
  B = (int *)malloc(M * sizeof(int));
  for(i=0;i<M;i++){
  scanf("%d",&B[i]);
  if(search(A,N,B[i])) count++;
  }

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



  return 0;
}

