from itertools import permutations N = int(input()) s = set() for x in range(N+1): if 3*x*x > N: break for y in range(x, N+1): if x == y == 0: continue if x*x + y*y + y*x > N: break if (N - x*y) % (x + y) != 0: continue z = (N - x*y) // (x + y) if y <= z: s.add((x, y, z)) ans = set() for e in s: ans.update(permutations(e)) print(len(ans)) for a in ans: print(*a)