while line = gets do
  n = line.to_i
  array1 = (3..n).select{|i| i % 2 != 0}
  array2 = [2]
  limit = Math.sqrt(n).to_i
  if array1.first >= limit
  (array1.first..limit).each do |first|
    next if array1.index(first) == nil
    prime = array1.delete(first)
    array2.push prime
    (prime ** 2).step(n, prime){|j| array1.delete(j) if array1.include?(j)}
  end
  end
  array2.concat array1
  puts array2.length
end