#include using namespace std; int main() { vector v(100000000); for (int64_t i = 1; i <= 100000000; i++) { v[i - 1] = i * (i + 1) / 2; } int64_t n; cin >> n; if (find(v.begin(), v.end(), n) != v.end()) { cout << 1 << endl; return 0; } for (auto &i : v) { auto itr = lower_bound(v.begin(), v.end(), n - i); if (itr != v.end() && i + *itr == n) { cout << 2 << endl; return 0; } } cout << 3 << endl; return 0; }