#include <stdio.h>
int main(void) {
  int n, i, j, countA, countB, equal, num;
  int A[100], B[100], same[100];

  // input the number of array for A[]
  scanf("%d", &n);
  for (countA = 0; countA < n; countA++)
    scanf("%d", &A[countA]);

  // input the number of array for B[]
  scanf("%d", &n);
  for (countB = 0; countB < n; countB++)
    scanf("%d", &B[countB]);

  //   if (countA > countB) {
  //     for (i = 0; i < countA; i++) {
  //       equal = i;
  //       for (j = 0; j < countB; j++) {
  //         if (A[equal] == B[j])
  //           num++;
  //       }
  //     }
  //   }

  //   else if (countA < countB) {
  //     for (i = 0; i < countB; i++) {
  //       equal = i;
  //       for (j = 0; j < countA; j++) {
  //         if (A[equal] == B[j])
  //           num++;
  //       }
  //     }
  //   }

  if (countA > countB) {
    for (i = 0; i < countB; i++) {
      equal = i;
      for (j = 0; j < countA; j++) {
        if (A[j] == B[equal]) {
          num++;
          break;
        }
      }
    }
  }

  if (countA < countB) {
    for (i = 0; i < countA; i++) {
      equal = i;
      for (j = 0; j < countB; j++) {
        if (A[equal] == B[j]) {
          num++;
          break;
        }
      }
    }
  }

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

  return 0;
}
