#include <stdio.h>
int binarysearch(int, int ,int *);
int main(){
  int i,j,k,c=0,n=0,q=0,s[10000],t[500];
  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[j]);
  }
  for(k=0;k<q;k++){
    if(binarysearch(t[k],n,s)!=0)c++;
  }
  printf("%d\n",c);
  return 0;
}
int binarysearch(int key,int N,int *A)
{
  int l = 0,r = N,mid = 0;
  while(l < r){
    mid = (l + r)/2;
    if(A[mid]==key)return 1;
    else if (key < A[mid])r = mid;
    else l=mid+1; 
  }
  return 0;
}