#include <stdio.h>
#include <stdlib.h>

int LinearSearch(int *,int ,int);

#define N_MAX 10000
#define Q_MAX 500

int main() {
  int n,q;
  int *T;
  int *S;
  int i;
  int number;
  int count=0;

  scanf("%d",&n);

  T = (int *)malloc(n * sizeof(int));
  
  for(i=0;i<n;i++) {
    scanf(" %d",&T[i]);
  }

  scanf("%d",&q);

  S = (int *)malloc(q * sizeof(int));
  for(i=0;i<q;i++) {
    scanf(" %d",&S[i]);
  }

  for(i=0;i<n;i++) {
    number=LinearSearch(S,T[i],q);
    if(number!=-1) count++;   
  }
  //for(i=0;i<q;i++) printf("%d ",S[i]);

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

int LinearSearch(int *A,int key,int q) {
  int i=0;
  A[q] = key;
  while(A[i] != key) {
    i++;
    if(i==q) return -1;
  }
  return 1;
}

