#include <bits/stdc++.h>

using namespace std;

int a[100005];

int main(){
    int n,q,tmp;
    cin >> n;
    int count = 0;
    for(int i = 0;i<n;i++){
        scanf("%d",&a[i]);
    }
    cin >> q;
    for(int j = 0;j<q;j++){
        scanf("%d",&tmp);
        if(binary_search(a,a+n,tmp)){
            count++;
        }
    }

cout << count << endl;
    return 0;
}
