#エラトステネスの篩
MAX_NUM = 999999
primes = []
max = Math.sqrt(MAX_NUM).ceil
#arr = [*2..MAX_NUM]
arr = Array.new(MAX_NUM){|i| i.even? ? nil : i}              
arr[0..2] = [nil, nil, 2]
0.upto(max) {|i|
  next if arr[i] == nil
  primes << arr[i]
  #偶数は処理済みなので1つ飛ばしで篩を行う
  i.step(arr.length, primes.last * 2){|j| arr[j] = nil}
}
primes.concat(arr.compact!)
#Prime Number
while gets
  n = $_.to_i
  puts primes.take_while{|i| i <= n}.length
end