#include<stdio.h>
#define N 10000
#define Q 500

main(){
  int n,q;
  int S[N],T[Q];
  int i,j;
  int c=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(j=0;j<q;j++){
    for(i=0;i<n;i++){
      if(T[j]==S[i]){
	c++;
      }
    }
  }

  printf("%d\n",c);

  return 0;

}

