#include <stdio.h>

int main(){
    int n,q,i=0,j=0,count=0;
    int S[10000],T[500];
    
    scanf("%d",&n);
    while(i<n){
        scanf("%d",&S[i]);
        i++;
    }
    i = 0;
    scanf("%d",&q);
    while(i<q){
        scanf("%d",&T[i]);
        i++;
    }
    
    i = 0;
    
    for(j=0;j<q;j++){
        S[n] = T[j];
        while(S[i]!=T[j]){
            i++;
        }
        if(i!=n){
            count++;
        }
    }
    
    printf("%d\n",count);
    
    return 0;
}


