#エラトステネスの篩
MAX_NUM = 999999
primes = []
max = Math.sqrt(MAX_NUM).ceil
arr = [*2..MAX_NUM]
0.upto(max) {|i|
  next if arr[i] == nil
  primes << arr[i]
  i.step(limit = arr.length, step = primes.last){|j| arr[j] = nil}
}
primes.concat(arr.compact!)
#Prime Number
while gets
  n = $_.to_i
  puts primes.count{|i| i <= n}
end