#include<stdio.h>
#define N 100000
int binarySearch(int *,int key);

main(){
  int i,j,k,l,count=0,a[N],b,c[N],d;
  scanf("%d",&b);
  for(i=0;i<b;i++){
    scanf("%d",&a[i]);
  }

  scanf("%d",&d);
  for(j=0;j<d;j++){
    scanf("%d",&c[j]);
  }

  for(i=0;i<d-1;i++){
  k = binarySearch(a,c[i]);
  if(k<N)count++;
  }
  printf("%d\n",count);
  return 0;
}

int binarySearch(int *A,int key){
  int left=0;
  int right=0;
  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;
  }
}