while gets do
  max = $_.to_i

  prime_list = [false, false] + [true] * (max - 1)

  (2..max).each do |i|
    next unless prime_list[i]
    limit = ((max.to_f/i.to_f) - i.to_f).truncate
    (0..limit).each do |j|
      prime_list[(i*i) + i*j] = false
    end
  end

  puts prime_list.select{ |p| p }.count
end