#include <stdio.h>
int main(void)
{
  int i;
  
  int n; 
  scanf("%d",&n);
  int S[n];
  for(i=0;i<n;i++) {
    scanf("%d",&S[i]);
  }

  int q;
  scanf("%d",&q);
  int T[q];
  for(i=0;i<q;i++) {
    scanf("%d",&T[i]);
  }

  int count=0;

  for(i=0;i<q;i++) {
    int left=0,right=n-1;
    while(left<=right) {
      int mid=(left+right)/2;
      if(T[i]==S[mid]) {
	count++;
	break;
      }
      else if(T[i]>S[mid])
	left=mid+1;
      else
	right=mid-1;
    }
  }

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