import java.io.*; import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); HashSet ans = new HashSet<>(); for (int i = 0; i * i * 3 <= n; i++) { for (int j = Math.max(1, i); i * j * 2 + j * j <= n && (n - i * j) / (i + j) >= j; j++) { if ((n - i * j) % (i + j) == 0) { int k = (n - i * j) / (i + j); ans.add(new Answer(i, j, k)); ans.add(new Answer(i, k, j)); ans.add(new Answer(j, i, k)); ans.add(new Answer(j, k, i)); ans.add(new Answer(k, i, j)); ans.add(new Answer(k, j, i)); } } } System.out.println(ans.size()); StringBuilder sb = new StringBuilder(); for (Answer x : ans) { sb.append(x).append("\n"); } System.out.print(sb); } static class Answer { int a; int b; int c; public Answer(int a, int b, int c) { this.a = a; this.b = b; this.c = c; } public int hashCode() { return a + b + c; } public boolean equals(Object o) { Answer x = (Answer)o; return a == x.a && b == x.b && c == x.c; } public String toString() { return new StringBuilder().append(a).append(" ").append(b).append(" ").append(c).toString(); } } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }