n=1000000
p_list=Array.new(n+1,1)
p_list[0..1]=[nil,nil]
(2..n**(1/2.0)).each do |i|
  if p_list[i]
    (2..n/i).each do |j|
      p_list[i*j]=nil
    end
  end
end

while gets
  puts p_list[0..$_.to_i].count{|p| p}
end