#include using namespace std; using ll = long long; using ul = unsigned long; using ull = unsigned long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; set s; ll val{ 0 }, i{ 1 }; while (val < n) { val = i * (i + 1) / 2; s.insert(val); ++i; } int res = 3; if (s.count(n)) res = 1; else { for (auto it = s.crbegin(); it != s.crend(); ++it) { if (s.count(n - *it)) { res = 2; break; } } } cout << res << "\n"; return 0; }