function Main( input ){
    input = input.split("\n");

    var n = parseInt(input[0]);
    var q = parseInt(input[2]);

    input[1] = input[1].split(" ");
    input[3] = input[3].split(" ");
    var S = new Array(10000);
    var T = new Array(500);

    for(var i = 0;i < n;i++){
        S[i] = input[1][i];
        T[i] = input[3][i];
    }

    var count = 0;

    for(var i = 0;i < q;i++){
        for(var j = 0;j < n;j++){
            if(S[j] === T[i]){
                count++;
            }
        }
    }
    console.log(count);
}


Main( require( 'fs' ).readFileSync( '/dev/stdin', 'utf8' ) )