let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});

process.stdin.on('end', () => {
  let [, s, , t] = content
    .trim()
    .split('\n')
    .map(line => line.split(' ').map(n => +n));

  let cnt = 0;
  for (let num of t) {
    if (s.includes(num)) {
      cnt++;
    }
  }

  console.log(cnt);
});

