const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const inputs = input.trim().split('\n');
const n = Number(inputs[0]);
const S = inputs[1].split(' ').map(Number);
const q = Number(inputs[2]);
const T = inputs[3].split(' ').map(Number);

const search = (list, value) => {
  const node = { left: 0, right: list.length };
  while (node.left + 1 < node.right) {
    const index = Math.floor((node.left + node.right) / 2);
    node[list[index] <= value ? 'left' : 'right'] = index;
  }
  return list[node.left] === value;
}

console.log(T.map(v => search(S, v)).reduce((a, b) => a + b));

