primes = [2]
(3..999999).each do |i|
   isq = Math.sqrt(i)
   prime_flag = 0 #flag 0 means prime
   catch(:exit){
	  primes.each do |p|
		 if p > isq
			break
		 end
		 if i % p == 0
			throw :exit
		 end
	  end
	  primes.push(i)
   }
end
def prime_num(num, primes)
   primes.each_with_index do |each, index|
	  if num < each
		 return index
	  end
   end
   return primes.length
end
while line = gets
   num = line.to_i
   puts prime_num(num,primes)
end