#include <stdio.h>
#define N 100000
#define K 50000
int binary(int*,int,int);
int main(){
  int n,q;
  int S[N],T[K];
  int i,k,num=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++){
  k = binary(&S[0], T[i],n);
  if(k!=0)num++;
  }
  printf("%d\n", num);
  
  return 0;
}

int binary(int *s,int t,int n){
  int r=n, l=0;
  int mid;
  while(l<r){
    mid=(r+l)/2;
    if(*(s+mid) == t)return t;
    else if(t < *(s+mid))r=mid;
    else l=mid+1;
  }
  
  return 0;
}

