#include <stdio.h>

int i,c=0;

void BinarySearch(int *A,int key){
  int left=0;
  int right=i;
  int mid;
  while(left<right){
    mid=(left+right)/2;
  
    if(key==A[mid]){
    c++;
    return;
    }
    if(key>A[mid]){
      left=mid+1;
    }else if(key<A[mid]){
      right=mid;
    }
  }
}

main(){
  int S[10000];
  int t,j,q,n;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }

  scanf("%d",&q);
  for(j=0;j<q;j++){
    scanf("%d",&t);
    BinarySearch(S,t);
  }

  printf("%d\n",c);
  return 0;
}