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

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

const search = (target, value) => {
  let l = 0;
  let r = target.length;
  while (l < r) {
    const index = Math.floor((l + r) / 2);
    if (target[index] < value) {
      l = index;
    } else if (target[index] > value) {
      r = index;
    } else {
      return true;
    }
  }
  return false;
}

let count = 0;
T.forEach((t) => {
  if (search(S, t)) {
    count++;
  }
});
console.log(count);

