from itertools import permutations def make_divisors_pairs(n): #約数のペアを作る O(sqrt(n)) divisors = [] i = 1 while i*i <= n: if n % i == 0: divisors.append([i,n//i]) i += 1 return divisors N = int(input()) ans = set() for x in range(int((N/3)**(1/2))+10): for p, q in make_divisors_pairs(N+x*x): if p-x >= 0 and q-x >= 0: for per in permutations((x, p-x, q-x)): ans.add(per) print(len(ans)) for a in ans: print(*a)