var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n").map(Number);
Arr.shift();
var max=Arr.reduce(function(a,b){return Math.max(a,b);});
Arr.sort(function(a,b){a-b;});
var max=Arr[Arr.length-1];
var arr=[2];
for(var i=3;i<=max;i++){
   var a=true;
   for(var j=0;j<arr.length;j++){
      if(i%arr[j]==0){a=false;break;}
   }
   if(a)arr.push(i);
   i++;
}

var num=0;
var f=0;
for(var i=0;i<Arr.length;i++){
   var index=arr.indexOf(Arr[i],f);
   if(index!=-1){
      f=index;
      num++;
   }
}
console.log(num);