class PrimeNumber
  def initialize n
    @n = n
    @list = (0...n).map{|i| true}
    @list[0] = false
  end

  def set_list
    n = Math.sqrt(@n).to_i
    n.times do |i|
      next if !@list[i]
      div = i + 1
      (2 * i + 1).step(@n - 1, i + 1) do |j|
        @list[j] = false if !@list[j] || (j + 1) % div == 0
      end
    end
  end

  def prime? n
    false if @n < n
    @list[n]
  end

  def number_of_prime
    @list.count(true)
  end
end


while line = gets do
  n = line.to_i
  prime = PrimeNumber.new(n)
  prime.set_list
  puts prime.number_of_prime
end