#include<iostream>
#include<cmath>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<cstdlib>
#include<queue>
#include<list>
using namespace std;

int main(){
    int n, m, b, j, ans=0;
    cin>>n;
    int a[n+1];
    for(int i=0; i<n; i++) cin>>a[i];
    cin>>m;
    for(int i=0; i<m; i++){
        cin>>b;
        a[n]=b;
        for( j=0; a[j]!=b; j++);
        if(j!=n)ans++;
            
    }
    cout<<ans<<endl;
    
}


#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <queue>
#include <stack>
#include <list>
using namespace std;

int main(int argc, char *argv[])
{
  vector<int> S;
  int q = 0;
  int t = 0;
  int C = 0;
  int n = 0;
  int s = 0;


  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    S.push_back(s);
  }
  sort(S.begin(), S.end());

  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> s;
    int start = 0;
    int end = S.size();
    while (start < end) {
      // cout << start <<" "<< end << "\n";
      if (S[(int)((end + start)/2)] < s) {
	start = (int)((end+start)/2)+1;
      }else if(S[(int)((end + start)/2)] > s){
	end = (int)((end + start)/2);
      }
      else{
	C++;
	break;
      }
    }
      
  }
  cout << C << "\n";
  return 0;
}

