#include #define rep(i,n) for(int i=0;i<(int)(n);i++) using namespace std; using ll = long long ; using P = pair ; using pll = pair; constexpr int INF = 1e9; constexpr long long LINF = 1e17; constexpr int MOD = 1000000007; const int MX = 5010; vector trinum(MX,0); void init(){ rep(i,MX){ trinum[i] = i*(i+1)/2; } } int main(){ init(); int n; cin >> n; int ans = 3; rep(i,MX){ if(trinum[i]==n){ ans = 1; break; } rep(j,MX){ if(trinum[i] + trinum[j] == n){ ans = 2; } } } cout << ans << endl; return 0; }