from itertools import * def div(n): if n <= 0: return [] S = set() i = 1 while i * i <= n: if n % i == 0: S.add(i) S.add(n // i) i += 1 return list(S) N = int(input()) x = 0 ans = [] while 3 * x * x <= N: for d in div(N + x ** 2): y = d - x z = (N + x**2)//d - x if y < x or z < x or z < y: continue ans.append((x, y, z)) x += 1 S = set() for a in ans: for x, y, z in permutations(a): S.add((x, y, z)) print(len(S)) for x, y, z in S: print(x, y, z)