#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <tuple>
#include <functional>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <map>
#include <random>
//#include "toollib.h"
//#include "puzzle.h"
#define INT_MAX 2147483647
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#pragma warning (disable:4018)
#pragma warning (disable:4244)
#pragma warning (disable:4996)

using namespace std;
typedef long long int lint;


//***** Main Program *****

int main() {
	int n, q;
	cin >> n;
	vector<int> S(n);
	Loop(i, n) cin >> S[i];
	cin >> q;
	vector<int> T(q);
	Loop(i, q) cin >> T[i];
	int ret = 0;
	Loop(i, q) {
		Loop(j, n) {
			if (S[j] == T[i]) {
				ret++;
				break;
			}
		}
	}
	cout << ret << endl;
	return 0;
}
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

void init(vector<int>& v){
  int n = 0;
  int input;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> input;
    v.push_back(input);
  }
  sort(v.begin(), v.end());
  v.erase( unique(v.begin(), v.end()), v.end() );
}

int linearsearch(int key, vector<int> t, int count){
  int i = 0;
  t.push_back(key);
  while(t[i]!=key){
    i++;
  }
  if(t.size()-1!=i) return count+1;
  else return count;
}

int main(int argc, char* argv[]){
  vector<int> a, b;
  int count = 0;
  init(a);
  init(b);
  for (auto i : a) count = linearsearch(i, b, count);
  cout << count << endl;
}