#include<iostream>
using namespace std;

int main(){
    int n,q;
    cin >> n;
    int S[n];
    for ( int i = 0;i < n;i++)cin >> S[i];
    cin >> q;
    int T[q];
    for ( int i = 0;i < q;i++)cin >> T[i];
    
    int x = 0;
    int mid;
    int left = 0;
    int right = n;
    for ( int j = 0;j<q;j++){
        left = 0;
        right = n;
        while(left<right){
        mid = (left+right) / 2;
            if (S[mid]==T[j]){
                x++;
                break;
            }else if(T[j] < S[mid]){
                right = mid;
            }else if(T[j] > S[mid]){
                left = mid;
            }
        }
    }
    cout << x << endl;
    
    
    return 0;
}