def Prime?(n)
	return false if n == 1
	return true if $primelist.include?(n)

	if $primelist.max() < n / 2
		for i in $primelist.max+1..n/2
			isprime = true
			$primelist.each { |p|
				isprime = false if i % p == 0
			}
			$primelist << i if isprime
		end
	end

	a = true
	$primelist.each { |p|
		break if p > n/2
		if n % p == 0
			a = false
			break
		end
	}
	return a
end

$primelist = Array.new(0)
$primelist << 2

n = 0
gets.to_i.times { n += 1 if Prime?(gets.to_i) }

puts "#{n}"