#include <stdio.h>

int main() {
  int i, j;
  int n, q, count;
  int c[10000], t[500];

  scanf ("%d", &n);
  for (i = 0 ;i < n ; i++) {
    if (i > 0)
      printf (" ");
    scanf ("%d", &c[i]);
  }
  scanf ("%d", &q);
  for (i = 0 ;i < n ; i++) {
    if (i > 0)
      printf (" ");
    scanf ("%d", &q[i]);
  }

  count = 0
  for (i = 0 ;i < n ; i++) {
    for (j = 0 ;j < n ; j++) {
      if (c[i] == t[j])
        count++;
    }
  }

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

  return 0;
}