const config = {
    input: '/dev/stdin',
    newline: '\n'
};

const line = require('fs').readFileSync(config.input, 'utf-8').split(config.newline);

const bs = (arr, n, start, end) => {
    start = start || 0;
    end = end || arr.length;

    if (arr.length === 0 || start > end) return false;
    const mid = Math.floor((start + end) / 2);
    if (n === arr[mid]) return true;
    if (n < arr[mid]) {
        return bs(arr, n, start, mid-1);
    } else {
        return bs(arr, n, mid+1, end);
    }
};

const solve = (arr1, arr2) => arr2.filter(x => bs(arr1, x)).length;

const data1 = line[1].split(' ').map(Number);
const data2 = line[3].split(' ').map(Number);

console.log(solve(data1, data2));

