#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,n) for(int i=0; i=b; --i) #define ALL(c) (c).begin(), (c).end() typedef long long ll; typedef vector VI; typedef vector VL; typedef vector VVL; typedef vector VVI; typedef pair P; typedef pair PL; int main() { int n; cin >> n; VI tri; FOR(i,1,100000){ int x = i * (i+1) / 2; if (x > n) break; tri.push_back(x); if (x == n){ cout << 1 << endl; return 0; } } for (int x : tri) for (int y : tri){ if (x + y == n){ cout << 2 << endl; return 0; } } cout << 3 << endl; return 0; }