from math import floor import sys sys.setrecursionlimit(10**9) S = int(input()) T = [] def f(X): if X == 0 and len(T) <= 15: print(len(T)) print(*T) exit() if len(T) > 15: return False a = floor(X**0.5) for i in range(a, 0, -1): T.append(i*i) if f(X - i*i): T.pop() for j in range(a-3, 0, -3): T.append(j*j) f(X - j*j) T.pop() T.pop() f(S)