while line = gets do
  n = line.to_i
  array1 = (2..n).select{|i| i % 2 != 0 && i % 3 != 0 && i % 5 != 0 && i % 7 != 0}
  array2 = [2, 3, 5, 7]
  limit = Math.sqrt(n)
 
  array2.concat array1
  puts array2.length
end