#include<stdio.h>
int binarySearch(int*,int,int);
int main(){
  int a,b,i,j,flag=0;
  int aa[100000];
  int bb[50000];
  int count=0,judge=0;
  scanf("%d",&a);
  for(i=0;i<a;i++){
    scanf("%d",&aa[i]);
  }
  scanf("%d",&b);
  for(j=0;j<b;j++){
    scanf("%d",&bb[j]);
    judge=binarySearch(aa,bb[j],a);
    if(judge!=0){
      count++;
      flag=1;
    }
  }
  if(flag==0){
    printf("0\n");
  }
  else{
    printf("%d\n",count);
  }
  return 0;
}

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