#include<stdio.h>
#define LEN1 100000
#define LEN2 500
#define NOT_FOUND -1

int linearSearch(int *, int, int);

int linearSearch(int *a, int n, int key){
  int i=0;
  a[n] = key;
  
  while(a[i] != key){
    i++;

    if(i > n) return NOT_FOUND;
  }
  return i;
}

int main(){
  int i, count=0;
  int n, q, S[LEN1], T[LEN2];

  scanf("%d", &n);
  for(i=0; i<n; i++)
    scanf("%d", S);

  scanf("%d", &q);
  for(i=0; i<q; i++)
    scanf("%d", T);

  for(i=0; i<q; i++){
    if(linearSearch(S, n, T[i]) != NOT_FOUND) count++;
  }

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

