#include<stdio.h>
#define MAX 100000
#define NOT_FOUND -1
int binarySearch(int );
int n,s[MAX];
int main(){
  int i,q,t[MAX],res=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",&t[i]);
  }
  
  for(i=0;i<q;i++){
    if(binarySearch(t[i]) == 1)
      res++;
  }
  printf("%d\n",res);
  return 0;
}
int binarySearch(int a){
  int left,right,mid;
  left = 0;
  right = n;
  while(left<right)
    mid = (left+right)/2;
  if(s[mid] == a)
    return 1;
    else if(a<s[mid])
      right = mid;
    else
      left = mid+1;
  return NOT_FOUND;
}