N = int(input()) ans = [] ### x < y < z for x in range(N): for y in range(x+1,N+1): if 2*x*y + y*y > N: break n = N - x*y if n%(x+y): continue z = n // (x+y) if z <= y: continue ans.append([x,y,z]) ans.append([x,z,y]) ans.append([y,x,z]) ans.append([y,z,x]) ans.append([z,x,y]) ans.append([z,y,x]) ### x = y ,z for x in range(1,N+1): n = N - x**2 if n < 0 or n%(x+x): continue z = n // (x+x) if z == x: ans.append([x,x,x]) else: ans.append([x,x,z]) ans.append([x,z,x]) ans.append([z,x,x]) print(len(ans)) for x,y,z in ans: print(x,y,z)