#include<stdio.h>
#define N 10000
void binarySearch(int);
int count,n,A[N];
int main(){
  int q,i,r;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  count = 0;
  for(i=0;i<q;i++){
    scanf("%d",&r);
    binarySearch(r);
  }
  printf("%d\n",count);
  return 0;
}
void binarySearch(int r){
  int i,left,mid,right;
  left = 0;
  right = n;
  while( left < right ){
    mid = (left + right) / 2;
    if( A[mid] == r ){
      count++;
      return;
    }
    else if( r < A[mid] ){
      right = mid;
    }
    else {
      left = mid + 1;
    }
  }
  return ;
}