#include <bits/stdc++.h>

using namespace std;

int n, q;

int binary_search(int *S, int T_key, int n);
int linear_search(int *S, int *T, int num);


int main() {

   
    cin >> n;

    int S[n+1];
    for(int i = 0; i<n; i++){
        cin >> S[i];
    }
    cin >> q;
    //cout <<"q: " << q << endl;
    
    int T[q];
    for(int i = 0; i < q; i++){
        cin >> T[i];
        //cout << T[i];
    }

    int num = 0;

    //num = linear_search(S, T, num);
    
    int exist=99999;
    for(int i = 0; i < q;i++){
        exist = binary_search(S, T[i],n);
        if(exist == true){
            num += 1;
        }else if(exist == -1){
            //cout <<"バグです。 \n" << endl;
        }
    }
    

    cout << num << endl; //num: Tに含まれる文字の中で, Sに含まれる文字の数

    return 0;
}

int binary_search(int *S, int T_key, int n){
    int left = 0;
    int right = n;
    int exist = false;

    //printf("Searching T_ley = %d \n", T_key);
    //printf("init (left, right) = (%d, %d) \n", left, right);

    int mid = -1;
    while(true){
        mid = (left + right)/2;
    
        //printf("(mid, S[mid]) = (%d, %d) \n", mid, S[mid]);
        
        if(S[mid] == T_key){
            //printf("S[mid] == T_key \n");
            exist = true; //1を返す。
            return exist;
        }else if(S[mid] < T_key){
            if(left != mid)
                left = mid;
            else{
                exist = false;
                return exist;
            }
        }else if(S[mid] > T_key){
            if(right != mid)
                right = mid;
            else{
                exist = false;
                return exist;
            }
        }

    }


    return -1;
}


//配列Sが昇順に並んである前提

/*
int binary_search(int *S, int *T, int num, int n){
    num = 0;
    int flag = 1;
    int left = 0;
    int right = n;

    int mid = -1;

    mid = (left + right) / 2;
    cout << "mid(initial): "<< mid << endl;

    for(int i = 0; i < q;i++){
        int left_prev = -1;
        int right_prev = -1;
       
        while(flag){ //T[i]が配列Sに存在するかを二分探索を使って確かめる.
              
            if((left == left_prev) || (right == right_prev)){
                flag = 0;
            }else {
                left_prev = left;
                right_prev = right;
            }
            mid = (left + right) / 2; //切り捨て
            //cout <<"left < right: bynary_search" << endl;

            //printf("(S[mid], T[i], i, mid, left, right)=(%d,%d,%d,%d,%d,%d)\n", S[mid], T[i], i, mid, left, right);
            //printf("(left, right) = (%d, %d) \n", left, right);
            //cout << "mid(initial): "<< mid << endl;

            if(S[mid] == T[i]){
                printf("(S[mid], T[i], i, mid, left, right)=(%d,%d,%d,%d,%d,%d)\n", S[mid], T[i], i, mid, left, right);
                cout <<"S[mid] == T[i]: bynary_search" << endl;
                num += 1;
                break;
            }
            else if(S[mid] > T[i]){
                cout <<"S[mid] > T[i]: bynary_search" << endl;
                //printf("(S[mid], T[i], i, mid)=( %d,%d,%d,%d )\n", S[mid], T[i], i, mid);
                right = mid;
            }
            else if(S[mid] < T[i]){
                printf("(S[mid], T[i], i, mid, left, right)=(%d,%d,%d,%d,%d,%d)\n", S[mid], T[i], i, mid, left, right);
                cout <<"S[mid] < T[i]: bynary_search" << endl;
                //printf("(S[mid], T[i], i, mid)=( %d,%d,%d,%d )\n", S[mid], T[i], i, mid);
                left = mid;
            }else if(left >= right){ //T[i]はSに存在しないT
                cout << "left >= right" << endl;
                //printf("(left, right,flag) = (%d, %d, %d) \n", left, right, flag);
                flag = 0;
            }
            else cout << "error" << endl;

        }
    }

    return num;
}
*/
int linear_search(int *S, int *T, int num){
    num = 0;
    for(int i = 0; i < q; i++){
        for(int j = 0; j < n; j++){
            if(T[i] == S[j]){
                //printf("(j, S[j]) =  (%d, %d)  ", j, S[j]);
                //printf("(i, T[i]) =  (%d, %d) ", i, T[i]);
                //cout << endl;
                num = num + 1;
                break;
            }
        }
    }
    return num;
}


Measured memory_bytes: 3584