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));
  
  // s is sorted
  let cnt = 0;
  for (let num of t) {
    if (binSearch(s, num) > -1) {
      cnt++;
    }
  }

  console.log(cnt);
});


const binSearch = (arr, n) => {
  let start = 0;
  let end = arr.length;
  while (start < end) {
    let mid = Math.floor((end + start) / 2);
    const num = arr[mid];
    if (num === n) {
      return mid;
    } else if (num < n) {
      start = mid + 1;
    } else {
      end = mid;
    }
  }

  return -1;
};
