#include <stdio.h>
int binarySearch(int,int);
int A[10000];
int main() {
  int n1,n2,i,d,count=0;
  scanf("%d",&n1);
  for(i=0;i<n1;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&n2);
  for(i=0;i<n2;i++){
    scanf("%d",&d);
    if(binarySearch(d,n1)) count++;
  }
  printf("%d\n",count);
  return 0;
}

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