# cook your dish here from collections import defaultdict,deque from bisect import bisect_left,bisect_right from itertools import accumulate,permutations,groupby import sys from math import gcd,isqrt import heapq import math import string #from sortedcontainers import SortedSet, SortedList, SortedDict #import pulp import random #from more_itertools import* #from functools import cache #import pypyjit #pypyjit.set_param('max_unroll_recursion=-1') #sys.setrecursionlimit(10**6) #input=lambda :sys.stdin.readline()[:-1] class ready(): def getint(self): return int(input()) def getflo(self): return float(input()) def getmanyint(self): return map(int,input().split()) def gettree(self,n): g=[[] for _ in range(n)] for _ in range(n-1): u,v,c=map(int,input().split()) g[u-1].append([v-1,c]) g[v-1].append([u-1,c]) return g R=ready() #ここからコ―ド n=int(input()) #z固定したらz^2<=n/3になったな。 #なのでz^2<=n//3<=>z<=isqrt(z//3)です。 ans=[] sup=isqrt(n//3) for z in range(sup+1): for y in range(z+1): if z==y==0: continue if (n-z*y)%(z+y)==0: temp=list(set(permutations([z,y,(n-z*y)//(y+z)]))) for k in temp: ans.append(k) print(len(ans)) for a in ans: print(*a)