from itertools import permutations N = int(input()) ans = set() for x in range(int(N**(1/2))+1): for y in range(x, int(N**(1/2))+1): if x == y == 0: continue if (N - x * y) % (x + y) == 0: z = (N - x * y) // (x + y) if x <= y <= z: l = len(set([x, y, z])) if l == 1: ans.add((x, y, z)) elif l == 2: ans.add((x, y, z)) ans.add((y, z, x)) ans.add((z, x, y)) else: # l == 3 for i in permutations([x, y, z]): ans.add(tuple(i)) print(len(ans)) for i in ans: print(*i)