#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int n, q;
  cin >> n;
  int A[n];
  for(int i =0; i<n; ++i) cin >> A[i];

  cin >> q;
  int P[q];
  for(int j=0; j<q;++j) cin >> P[j];

  int count = 0;
  for(int j=0; j<q; ++j)
    count += binary_search(&A[0], &A[n], P[j]);

  cout << count << endl;
}
