x=int(input()) for i in range(1000123): if i*i%1000000==x: print("YES") break else: print("NO")