#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

int main() {
  int A[1000000], n;

  scanf("%d", &n);

  for (int i = 0; i < n; i++) {
    scanf("%d", &A[i]);
  }

  int q, k, sum = 0;

  scanf("%d", &q);

  for (int i = 0; i < q; i++) {
    scanf("%d", &k);
    if ( *lower_bound(A, A+n, k) == k) sum++;
  }

  cout << sum << endl;
  return 0;
}

