#include <stdio.h>

int bs(int [],int);

int n;
int main(){
  int s[];
  int key,count=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&s[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(bs(s,key)==key) count++;
  }
  printf("%d\n",count);
}

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