N = int(input()) x = 0 tmp = [] while 3 * x * x <= N: y = x if x == 0: y = 1 while y * (2 * x + y) <= N: if (N - x * y) % (x + y) == 0: z = (N - x * y) // (x + y) if x <= y <= z: if x == y == z: tmp.append((x, x, x)) elif x == y: tmp.append((x, x, z)) tmp.append((x, z, x)) tmp.append((z, x, x)) elif y == z: tmp.append((x, z, z)) tmp.append((z, x, z)) tmp.append((z, z, x)) else: tmp.append((x, y, z)) tmp.append((x, z, y)) tmp.append((y, x, z)) tmp.append((y, z, x)) tmp.append((z, x, y)) tmp.append((z, y, x)) y += 1 x += 1 print(len(tmp)) for t in tmp: print(*t)