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

  def set_prime_list
    n = Math.sqrt(@n).to_i
    n.times do |i|
      next if !@search_list[i]
      @prime_list[i] = true
      temp = i + 1
      @search_list.map!.with_index do |p, index, t = temp|
        if !p || ((index + 1) % t == 0 && (index + 1) != t)
          false
        else
          true
        end
      end
    end
  end

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

  def number_of_prime
    @search_list.count(true)
  end

end


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