#include using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; unordered_set exists; 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.insert(t); } for (int t : T) { if (exists.count(n - t)) { cout << 2 << endl; return 0; } } cout << 3 << endl; return 0; }