# 目次
# 問題
# 解答
inline bool search(vector<ll> v, ll target) {
if (target < v[0] || v[v.size()-1] < target) return false;
ll left = 0, right = v.size(), mid;
while (left < right) {
mid = (left + right) / 2;
if (v[mid] == target) return true;
else if (v[mid] < target) left = mid+1;
else right = mid;
}
return false;
}
int main(void) {
ll n, q, x;
vector<ll> vs, vt;
cin >> n;
ll i = 0;
loop(i, 0, n) {
cin >> x;
vs.push_back(x);
}
cin >> q;
ll count = 0;
loop(i, 0, q) {
cin >> x;
if (search(vs, x)) count++;
}
cout << count << endl;
}