import math from itertools import permutations N = int(input()) max_x = math.isqrt(N // 3) max_y = math.isqrt(N) ans_set = set() # ans_set にタプル(x,y,z)の並び替え6通りを登録する関数 def register(t: tuple): for p in permutations(range(3)): ans_set.add((t[p[0]], t[p[1]], t[p[2]])) for x in range(max_x + 1): for y in range(x, max_y + 1): if x == y == 0: continue z, mod = divmod(N - x * y, x + y) if z < y: break if mod == 0: register((x, y, z)) print(len(ans_set)) for ans in ans_set: print(*ans)