def erato(n)
  numbers = (0..n).to_a
  numbers[0], numbers[1] = nil
  m = []
  for d in numbers
    next unless(d)
    break if (Math::sqrt(n) < d)
    (2*d..n).step(d){|e| numbers[e] = nil}
  end
  numbers.delete(nil)
  s = numbers.size
  return s
end
while line = gets
  p erato(line.to_i)
end