require 'prime' a = gets.to_i count = 0 fps = (0..4).map { |n| 2**(2**n) + 1 } (3..a).each do |n| count += 1 if Prime.prime_division(n).all? do |x| x[0] == 2 || (fps.include?(x[0]) && x[1] == 1) end end puts count