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