max = 999_999

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

while line = gets
  n = line.chomp.to_i
  answer = 0
  primes.each do |prime|
    answer += 1 if prime <= n
    break if prime >= n
  end

  puts answer
end