let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});

process.stdin.on('end', () => {
  const cnt = content
    .trim()
    .split('\n')
    .map(n => +n)
    .reduce((prev, cur) => isPrime(cur) ? prev + 1 : prev, 0);
  console.log(cnt);
});


const isPrime = x => {
  if (x === 2) {
    return true;
  }

  if (x < 2 || x % 2 === 0) {
    return false;
  }
  
  const sqrtX = Math.floor(Math.sqrt(x));
  let i = 3;
  while (i <= sqrtX) {
    if (x % i === 0) {
      return false;
    }

    i += 2;
  }
  
  return true;
}
