var countPrimes = function(numbers) {
  var max = Math.max.apply(Math, numbers);
  var numList = {};
  numbers.forEach(function(n) {
    if (!numList[n]) {
      numList[n] = 0;
    }
    numList[n] += 1;
  });
  var counter = 0;
  var elems = [];
  for (var i = 3; i <= max; i += 2) {
    elems.push(i);
  }
  while (1) {
    var prime = elems.shift();
    counter += numList[prime] ? numList[prime] : 0;
    elems = elems.filter(function(elem) {
      return elem % prime !== 0;
    });
    if (prime > Math.sqrt(max)) {
      break;
    }
  }
  elems.forEach(function(elem) {
    counter += numList[elem] ? numList[elem] : 0;
  });
  return counter;
};

var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var numbers = input.split('\n').map(Number);
numbers.shift();
console.log(countPrimes(numbers));