import sys input=sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 N=I() from collections import defaultdict dd = defaultdict(int) M=10**5+2 for i in range(1,M): dd[i*i]+=1 flag=0 for i in range(1,M): aa=i*i bb=aa-N if dd[bb]: flag=1 if flag: print(1) else: print(-1) main()