import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); List ans = new ArrayList<>(); int count = 0; for (int i = 0; i <= Math.sqrt(n); i++) { for (int j = i; j <= Math.sqrt(n); j++) { if (i == 0 && j == 0) { continue; } if ((n - i * j) % (i + j) == 0 && (n - i * j) / (i + j) >= j) { Answer current = new Answer(i, j, (n - i * j) / (i + j)); count += current.size(); ans.add(current); } } } System.out.println(count); System.out.println(ans.stream().map(x -> x.toString()).collect(Collectors.joining("\n"))); } static class Answer { Set threes = new HashSet<>(); public Answer(int a, int b, int c) { threes.add(new Three(a, b, c)); threes.add(new Three(a, c, b)); threes.add(new Three(b, a, c)); threes.add(new Three(b, c, a)); threes.add(new Three(c, a, b)); threes.add(new Three(c, b, a)); } public int size() { return threes.size(); } public String toString() { return threes.stream().map(x -> x.toString()).collect(Collectors.joining("\n")); } } static class Three { int a; int b; int c; public Three(int a, int b, int c) { this.a = a; this.b = b; this.c = c; } public int hashCode() { return Objects.hash(a, b, c); } public boolean equals(Object o) { Three x = (Three)o; return a == x.a && b == x.b && c == x.c; } public String toString() { return a + " " + b + " " + c; } } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }