#include<cstdio>
#include<stdio.h>
#include<string>
#include<iostream> 
#include<map>
using namespace std;
#include<algorithm>

bool two(int *a,int left,int right,int num){
	while(left<right){
		int mid=(left+right)/2;
		if(a[mid]==num){
			return true;
		}
		else if(a[mid]>num){
			right=mid;
		} 
		else if(a[mid]<num){
			left=mid+1;
		}
	}
	return false;
}

int main(){
	int n,q,a[100005],b[100005],count=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	cin>>q;
	for(int i=0;i<q;i++){
		cin>>b[i];
	}
	sort(a,a+n);
	for(int i=0;i<q;i++){
		if(two(a,0,n,b[i])){
			count++;
		}
	}
	cout<<count<<endl;
	return 0;
}

#include <algorithm>
#include <bits/stdc++.h>
#include <deque>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;
#define INF 1LL << 40;
#define ll long long
#define REP(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define prique priority_queue
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<ll> vl;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
template <class T> inline void chmax(T &a, T b) { a < b ? a = b : a; };
template <class T> inline void chmin(T &a, T b) { a > b ? a = b : a; };
int main() {
    int n, q, res = 0;
    cin >> n;
    vi s(n);
    rep(i, n) cin >> s[i];
    cin >> q;
    vi t(q);
    rep(i, q) cin >> t[i];
    rep(i, q) rep(j, n) {
        if(t[i] == s[j]) {
            res++;
            break;
        }
    }
    cout << res << endl;
    return 0;
}
