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<>(); for (int i = 0; i * i <= n; i++) { for (int j = i; j * i <= n && j <= n; j++) { if (i == 0 && j == 0) { continue; } if ((n - i * j) % (i + j) == 0) { ans.add(new Answer((n - i * j) / (i + j), i, j)); if (i < j) { ans.add(new Answer((n - i * j) / (i + j), j, i)); } } } } System.out.println(ans.size()); System.out.println(ans.stream().map(x -> x.toString()).collect(Collectors.joining("\n"))); } 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 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(); } } }