#include <stdio.h>

#define NOT_FOUND -1
#define MAX 10000

int n, q;
int A[MAX];

/* ??????????????¢??¢?´¢ */
int linearSearch(int key) {
  int i;
  for (i = 0; i < n; i++) {
    if (A[i] == key)
      return i;
  }
  return NOT_FOUND;
}

/* ???????????¨???????????¢??¢?´¢??§,??????????????°????????????????????? */
int linearSearch_b(int key) {
  int i = 0;
  A[n] = key;
  while (A[i] != key)
    i++;
  if (i == n)
    return NOT_FOUND;
  else
    return i;
}

int main() {
  scanf("%d", &n);
  int j;
  for (j = 0; j < n; j++) {
    scanf("%d", A + j);
  }
  scanf("%d", &q);
  int key, count = 0;
  while (q--) {
    scanf("%d", &key);
    if (linearSearch_b(key) >= 0)
      count++;
  }
  printf("%d\n", count);
  return 0;
}