#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "debug.hpp"
#else
#define debug(...) 1
#endif

const int MX = 3300;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    set<tuple<int, int, int>> A;
    for (int x = 0; x <= MX; x++) {
        for (int y = 0; y <= MX; y++) {
            if (x == 0 && y == 0) {
                continue;
            }
            if (n - x * y < 0) {
                continue;
            }
            if ((n - x * y) % (x + y) == 0) {
                int z = (n - x * y) / (x + y);
                A.insert(make_tuple(x, y, z));
                A.insert(make_tuple(x, z, y));
                A.insert(make_tuple(y, x, z));
                A.insert(make_tuple(y, z, x));
                A.insert(make_tuple(z, x, y));
                A.insert(make_tuple(z, y, x));
            }
        }
    }
    vector<tuple<int, int, int>> ans(A.begin(), A.end());
    cout << ans.size() << '\n';
    for (int i = 0; i < (int) ans.size(); i++) {
        cout << get<0>(ans[i]) << ' ' << get<1>(ans[i]) << ' ' << get<2>(ans[i]) << '\n';
    }
}