from math import sqrt from itertools import permutations n = int(input()) ANS = set() th1 = n // 3 th2 = (n + 2) // 3 for x in range(n + 1): if x**2 > th1: break for z in range(max(int(sqrt(th2)) - 5, x), n + 1): res = n - x * z if res < 0: break if x + z > 0 and res % (x + z) == 0: y = res // (x + z) if x <= y <= z: L = [x, y, z] for P in permutations(range(3)): ANS.add((L[P[0]], L[P[1]], L[P[2]])) print(len(ANS)) for x, y, z in ANS: print(x, y, z)