#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define all(x) (x).begin(),(x).end() #define rep(i,m,n) for(int i = m;i < n;++i) #define pb push_back #define fore(i,a) for(auto &i:a) #define rrep(i,m,n) for(int i = m;i >= n;--i) #define INF INT_MAX/2 using namespace std; using ll = long long; using R = double; using Data = pair>; const ll MOD = 1e9 + 7; const ll inf = 1LL << 50; struct edge { ll from; ll to; ll cost; }; int main() { int n; cin >> n; vectorli; for (int i = 1; i*(i + 1) / 2 <= n; i++) { li.pb(i*(i + 1) / 2); } fore(x, li)if (x == n) { cout << 1 << endl; return 0; } fore(x, li)fore(y, li) { if (x + y == n) { cout << 2 << endl; return 0; } } cout << 3 << endl; return 0; }