#include using namespace std; bool exists[10000001]; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; vector T; for (int t, i = 1; (t = i * (i + 1) / 2) <= n; i++) { if (t == n) { cout << 1 << endl; return 0; } T.emplace_back(t); exists[t] = 1; } for (int t : T) { if (exists[n - t]) { cout << 2 << endl; return 0; } } cout << 3 << endl; return 0; }