#include <bits/stdc++.h>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> S( n );
	for( int i = 0; i < n; i++ ) {
		cin >> S[i];
	}

	int ans = 0;
	int q;
	cin >> q;
	for( int i = 0; i < q; i++ ) {
		int T;
		cin >> T;
		if( binary_search( S.begin(), S.end(), T ) ) {
			ans++;
		}
	}

	cout << ans << endl;
}

