#include<iostream>
#include<algorithm>
using namespace std;
int C,*S,*T;
int main(void)
{
	int n,q,i,j,right,left,mid;
	cin >> n;
	S = new int[n];
	for(i=0;i<n;i++){
		cin >> S[i];
	}
	cin >> q;
	T = new int[q];
	for(i=0;i<q;i++){
		cin >> T[i];
	}

	for(i=0;i<q;i++){
		left = 0;
		right = n;
		while(left < right){
			mid = (left+right)/2;
			if(T[i] == S[mid]){
				C++;
				break;
			}
			else if(T[i] > S[mid])
				right = mid;
			else
				left = mid + 1;
		}
	}
	cout << C << endl;
	return 0;
}