'use strict';

const main = input => {
  input = input.split('\n');
  const n = Number(input[0]);
  const S = input[1].split(' ').map(Number);
  const T = input[3].split(' ').map(Number);
  console.log(
    T.reduce((acc, num) => (linerSearch(S, n, num) > -1 ? acc + 1 : acc), 0)
  );
};

function linerSearch(arr, len, key) {
  let i = 0;
  arr[len] = key;
  while (arr[i] !== key) {
    i += 1;
  }
  return i === len ? -1 : i;
}

// function linerSearch(arr, len, key) {
//   for (let i = 0; i < len; ++i) {
//     if (arr[i] === key) {
//       return i;
//     }
//   }
//   return -1;
// }

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

