#include <iostream>
#include <algorithm>

using namespace std;

bool Bsearch(int key, int A[], int len) {
	int l = 0, r = len - 1;
	while (l <= r) {
		int mid = l + (r - l) / 2;
		if (A[mid] > key)
			r = mid - 1;
		else if (A[mid] < key)
			l = mid + 1;
		else
			return true;
	}
	return false;
}

int main() {
	int n, *S;
	int q, *T;
	int ans = 0;
	cin >> n;
	S = new int[n];
	for (int i = 0; i < n; i++)
		cin >> S[i];
	cin >> q;
	T = new int[q];
	for (int i = 0; i < q; i++)
		cin >> T[i];

	sort(S, S + n);
	for (int i = 0; i < q; i++)
		for (int j = 0; j < n; j++)
			if (Bsearch(T[i], S, n) == true) {
				ans++;
				break;
			}

	cout << ans << endl;
	delete[] S;
	delete[] T;
	return 0;
}
#include<iostream>
using namespace std;
int main(){
  int n,a[10000],m,b,ans=0;
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  cin>>m;
  while(m--){
    cin>>b;
    for(int i=0;i<n;i++)
      if(a[i]==b){ans++;break;}
  }
  cout<<ans<<endl;
  return 0;
}