#include<stdio.h>

#define NN 10000
#define NQ 500

int linearSearch(int ,int* ,int);

int main(){

  int n, S[NN], q, T[NQ];
  int i=0,count=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]);
    if(linearSearch(T[i], S, n)==1) count++;
  }

  printf("%d\n",count);
}

int linearSearch(int key, int* A, int n)
{

int  i = 0;

 A[n] = key;

while(A[i]!=key){
  i++;
  if(i == n) return 0;
 }

  return 1;
}