#include <stdio.h>

int LinearSearch(int *X, int *Y, int key1, int key2)
{
  int i, j, n=0;
  for(i = 0; i < key1; i++){
    for(j = 0; j < key2; j++){
      if(X[i] == Y[j]) n++;
    }
  }
  return n;
}

int main()
{
  int i, n, q, C;
  int S[100000], T[5000];

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

  C = LinearSearch(S, T, n, q);

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

  return 0;
}