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

class LinearSearch {
public:
	int n, q;
	vector< int > S, T;
	
	LinearSearch() {}
	
	void solve() {
		int ans = 0;
		
		for (int i = 0; i < q; ++i) {
			int tar = T[i];
			
			for (int j = 0; j < n; ++j) {
				if (S[j] == tar) {
					++ans;
					break;
				}
			}
		}
		
		cout << ans << endl;
	}
};

int main() {
	LinearSearch ls;
	
	cin >> ls.n;
	ls.S.assign(ls.n, 0);
	for (int i = 0; i < ls.n; ++i) cin >> ls.S[i];
	
	cin >> ls.q;
	ls.T.assign(ls.q, 0);
	for (int i = 0; i < ls.q; ++i) cin >> ls.T[i];
	
	ls.solve();
}
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;


int main(){
    int n,q,ans=0,chk=0;
    scanf("%d",&n);
    vector<int> s(n);
    for(auto&e:s){
        scanf("%d",&e);
    }
    sort(s.begin(),s.end());

    scanf("%d",&q);
    vector<int> t(q);
    for(auto&e:t){
        scanf("%d",&e);
    }
    sort(t.begin(),t.end());

    for(int i=0;i<q;i++){
        for(int j=chk;j<n;j++){
            if(t[i]==s[j]){
                ans++;
                break;
            }else if(t[i]<s[j]){
                break;
            }
            chk=j;
        }
    }
    printf("%d\n",ans);
    return 0;
}