#include <algorithm>
#include <cstdio>

static const size_t n_max = 100000;
static int S[n_max];

int main() {
  size_t n, q;
  scanf("%zu", &n);
  for (size_t i = 0; i < n; i++)
    scanf("%d", S + i);
  scanf("%zu", &q);
  int c = 0;
  for (size_t i = 0; i < q; i++) {
    int t;
    scanf("%d", &t);
    if (std::binary_search(S, S + n, t))
      c++;
  }
  printf("%d\n", c);
  return 0;
}