#include <stdio.h>

int main()
{
  int n,q,C=0,i,j,L,M,R;
  int S[10000],T[500];

  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]);
    L = 0;
    R = n;
    while(L<R){
      M = (L+R)/2;
      if(S[M]<T[i])
        L = M+1;
      if(S[M]==T[i]){
        C++;
        break;
      }
      if(S[M]>T[i])
        R = M;
    }
  }
  printf("%d\n",C);

  return 0;
}
