n = gets.to_i a = Math.sqrt(n).to_i result = false while true b = 1 while a > b result = true and break if a**2 - b**2 == n break if a**2 - b**2 < n b += 1 end break if result a += 1 end puts result ? 1 : 0