while gets
  n = $_.to_i
  if n < 2
    puts 0
    next
  end
  primes = []
  sqrt = Math.sqrt(n)
  arr = [*2..n]
  while arr.first < sqrt
    primes << arr.shift
    #arr.reject!{|item| item % primes.last == 0}
    arr.map!{|item| item % primes.last == 0 ? nil : item}
    arr.compact!
  end
  primes.concat(arr)
  puts primes.length
end