n = gets.to_i a = 3162277660168 # sqrt of 10**25 result = false while a * 2 < n b = 1 while a > b val = a**2 - b**2 result = true and break if val == n break if val < n b += 1 end break if result a -= 1 end puts result ? 1 : -1