#include <stdio.h>

int S[10000],n;

int search(int t){
  int left=0,light=n,mid;
  while (left<light){
    mid=(left+light)/2;
    if(t==S[mid])return 1;
    else if(t>S[mid])left=mid+1;
    else light=mid;
  }
  return 0;
}


int main(){
  int i,ans=0,S[10000],q,t;

  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);
          if(search(t))
              ans++;

     }

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


