#include using namespace std; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; vector A; int t, c = 1; while(true){ t = c * (c + 1) / 2; if(t > n) break; if(n == t){ cout << 1 << endl; return 0; } A.push_back(t); c++; } sort(A.begin(), A.end()); for(int i = 0; i < A.size(); i++){ for(int j = i + 1; j < A.size(); j++){ if(A[i] + A[j] == n){ cout << 2 << endl; return 0; } } } cout << 3 << endl; /* int dp[n + 1]; dp[0] = 0; for(int i = 1; i <= n; i++){ dp[i] = 1e9; } dp[1] = 1; for(int i = 1; i <= n; i++){ for(auto x : A){ if(i - x >= 0){ dp[i] = min(dp[i], dp[i - x] + 1); } } } */ return 0; }