(function() {
    'use strict';

    var fs = require('fs');
    var contents = fs.readFileSync('/dev/stdin', 'utf-8');

    var binarySearch = function(S, t) {
        var min = 0;
        var max = S.length;
        var mid = Math.floor((min + max) / 2);

        while (min <= max) {
            if (t === S[mid]) {
                return true;
            } else if (t > S[mid]) {
                min = mid + 1;
            } else {
                max = mid - 1;
            }
            mid = Math.floor((min + max) / 2);
        }
        return false;
    }

    var search = function(contents) {
        var S = [];
        var n = 0;
        var q = 0;
        var C = 0;
        var t = 0;

        var lines = contents.trim().split("\n");
        n = parseInt(lines[0]);
        S.length = n;
        var a = lines[1].split(" ");
        for (var i = 0; i < a.length; i++) {
            S[i] = parseInt(a[i]);
        }

        q = parseInt(lines[2]);
        var T = lines[3].split(" ");
        for (var i = 0; i < q; i++) {
            t = parseInt(T[i]);
            if (binarySearch(S, t)) {
                C++;
            }
        }
        console.log(C);
    }
    search(contents);
})();