#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  set<int> S;
  for (int i = 0; i < N; i++) {
    int n;
    cin >> n;
    S.insert(n);
  }

  int q;
  cin >> q;
  int count = 0;
  for (int i = 0; i < q; i++) {
    int n;
    cin >> n;
    if (S.count(n) > 0) count++;
  }
  cout << count << endl;
}
