#include "bits/stdc++.h" #define REP(i,n,N) for(ll i=(n); i<(N); i++) #define RREP(i,n,N) for(ll i=(N-1); i>=n; i--) #define CK(n,a,b) ((a)<=(n)&&(n)<(b)) #define ALL(v) (v).begin(),(v).end() #define p(s) cout<<(s)<> typedef long long ll; using namespace std; const ll mod = 1e9+7; int main() { int N,ans=3; unordered_map mp; cin>>N; for(int k=1;k*(k+1)<=2*N;k++){ mp[k*(k+1)/2]=1; if(k*(k+1)/2==N) { p(1); return 0; } } for(auto m:mp) { if(mp.find(N-m.first)!=mp.end()){ p(2); return 0; } } p(3); return 0; }