function main(input){
    let nums = input.split("\n").map(x=>parseInt(x));
    let length = nums.shift();
    let count=0;
    for(let i=0;i<length;i++){
        if(nums[i]===1) continue;
        if(nums[i]===2) {
            count++;
            continue;
        }
        if(nums[i]%2===0)continue;
        let j=3;
        let notPrime=false;
        while(j<=Math.sqrt(nums[i])){
            if(nums[i]%j===0){
                notPrime=true;
                break;
            }
            j+=2;
            
        }
        if(!notPrime) {
            count++;
        }
    }

   
    console.log(count);
}


main(require("fs").readFileSync("/dev/stdin","utf-8"));
