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

int main() {
  int n; cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }

  int q; cin >> q;
  int cnt = 0;
  for (int i = 0; i < q; i++) {
    int y; cin >> y;
    if (binary_search(v.begin(), v.end(), y))
    cnt++;
  }
  cout << cnt << endl;
}

