# 真ん中全探索か、2項の積の表を作るか、因数分解使うか、0を別に考えるか # まず真ん中全探索、x<=y<=zとしてyが固定されれば因数分解で(y+z)(y+x)=N+y**2 def divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] N = int(input()) ans_set = set() for y in range(0, N+1): if y**2 > N: break divs = divisors(N+y**2) for d1 in divs: if d1**2 > (N+y**2): break d2 = (N+y**2)//d1 x = d1-y z = d2-y if x>=0 and z>=0: ans_set.add((x, y, z)) ans_set.add((x, z, y)) ans_set.add((y, x, z)) ans_set.add((y, z, x)) ans_set.add((z, x, y)) ans_set.add((z, y, x)) print(len(ans_set)) for x, y, z in ans_set: print(x, y, z)