#include<stdio.h>

#define N 100000
#define Q 50000

int main(){
  int n,q,C=0;
  int S[N],T[N];
  int i,j,key;
  int l,m,r;

  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]);

  S[n]=-1;
  for(i=0;i<q;i++){
    l=0;
    r=n;
    key=T[i];
    if(S[n]==T[i])continue;
    S[n]=key;
    while(l<r){
      m=(l+r)/2;
      if(S[m] == key){
	C++;
	break;
      }
      else if(key<S[m])r=m;
      else l=m+1;
    }
  }

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