max = 999_999

primes = (2..Math.sqrt(max)).inject([*2..max]) do |nums, sieve|
  nums.reject { |num| num % sieve == 0 && num != sieve }
end

while line = gets
  n = line.chomp.to_i
  answer = primes.take_while { |prime| prime <= n }.length
  puts answer
end