#include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N; cin >> N; set> st; for (ll y = 1; y * y <= N; y++) { for (ll x = 0; x <= y; x++) { ll rem = N - x * y; // z >= y でないと x <= y <= z を満たさない if (rem < y * (x + y)) break; if (rem % (x + y) == 0) { ll z = rem / (x + y); st.insert({x, y, z}); st.insert({x, z, y}); st.insert({y, x, z}); st.insert({y, z, x}); st.insert({z, x, y}); st.insert({z, y, x}); } } } cout << st.size() << '\n'; for (const auto& [a, b, c] : st) { cout << a << ' ' << b << ' ' << c << '\n'; } }