let inputStr = '';

process.stdin.on('data', (input) => { inputStr += input; });

process.stdin.on('end', () => {
  const arr = inputStr.split('\n');
  search(arr[1].split(' ').map((s) => Number(s)), arr[3].split(' ').map((s) => Number(s)));
});

const search = (S, T) => {
  let match = 0;

  T.forEach((num) => {
    if (binarySearch(S, num) > -1) {
      match++;
    }
  });

  console.log(match);
};

const binarySearch = (base, num) => {
  let left = 0;
  let right = base.length;
  while (left < right) {
    const sum = left + right;
    let i = (sum % 2 === 1) ? (sum-1)/2 : sum/2;
    const center = base[i];
    if (center === num) {
      return i;
    }

    if (center > num) {
      right = i;
    } else {
      left = i + 1;
    }
  }

  return -1;
};;

