#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; A.push_back(t); c++; } 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); } } } cout << dp[n] << endl; return 0; }