while line = gets do
  n = line.to_i
  array1 = (2..n).map{|i| i}
  array2 = []
  limit = Math.sqrt(n)
  while 1 do
    prime = array1.delete(array1.first)
    array2.push prime
    prime.step(n, prime){|j| array1.delete(j) if array1.index j}
  end
  array2.concat array1
  puts array2.length
end