#include #include using namespace std; using namespace atcoder; using ll = long long; using ld = long double; using mint = modint998244353; ll N, x, y, z; vector> vec, ans; int main() { cin >> N; for (x = 0; x * x <= N; x++) { for (y = x; y * y <= N; y++) { if (x == 0 && y == 0) continue; z = (N - x * y) / (x + y); if ((N - x * y) % (x + y) == 0 && z >= y) { vec.push_back({x, y, z}); } } } for (auto p: vec) { sort(p.begin(), p.end()); do { ans.push_back({p[0], p[1], p[2]}); } while (next_permutation(p.begin(), p.end())); } cout << ans.size() << endl; for (int i = 0; i < ans.size(); i++) { cout << ans[i][0] << ' ' << ans[i][1] << ' ' << ans[i][2] << endl; } return 0; }