function Main(input) {
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});
    var n = parseInt(input[0][0]);
    var S = input[1].map(e => parseInt(e, 10));
    var q = parseInt(input[2][0]);
    var T = input[3].map(e => parseInt(e, 10));
    const lowerBound = (arr, n) => {
        let first = 0, last = arr.length - 1, middle;
        while (first <= last) {
            middle = 0 | (first + last) / 2;
            if (arr[middle] < n) first = middle + 1;
            else last = middle - 1;
        }
        return first;
    }
    var tmp;
    var ans = 0;
    for (var i = 0; i < q; i++){
        tmp = lowerBound(S, T[i]);
        if (S[tmp] === T[i]) ans++;
    }
    console.log(ans);
}

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