n = int(input()) ans = 0 lis = [] used = set() for x in range(int(n**(0.5))+2): for y in range(x,int(n**(0.5))+2): ue = n-x*y if ue >= 0: if x == y == 0: continue if (n-x*y)%(x+y) == 0: z = (n-(x*y))//(x+y) if x <= y <= z and x*y+y*z+x*z == n: tmp = [x,y,z] for i in tmp: for j in tmp: for k in tmp: if (i,j,k) not in used and i*j+j*k+i*k == n: ans += 1 used.add((i,j,k)) lis.append([i,j,k]) print(ans) for li in lis: print(*li)