n = int(input()) m = 0 for i in range(n+1): for j in range(i+1): for k in range(j+1): if (i*j + j*k + k*i) == n: m += 6 print(m) for i in range(n+1): for j in range(i+1): for k in range(j+1): if (i*j + j*k + k*i) == n: print(i, j, k) print(i, k, j) print(j, i, k) print(j, k, i) print(k, i, j) print(k, j, i)