//config = { input: 'tmp', newline: '\r\n' }; // win
config = { input: '/dev/stdin', newline: '\n' }; // linux

line = require('fs').readFileSync(config.input, 'ascii')
  .split(config.newline, 4);

S = line[1].split(' ').map(Number);
T = line[3].split(' ').map(Number);

C = T.reduce(function (p, c) {
  return p + ((S.indexOf(c) !== -1) ? 1 : 0); }, 0);

console.log(C);