#include using namespace std; #define int long long #define rep(i,n) for(int i=0; i<(int)n; i++) #define rep1(i,n) for(int i=1; i<(int)n; i++) #define repa(i,a,n) for(int i=(a); i<(int)(n); i++) #define all(vec) vec.begin(),vec.end() #define COUT(x) cout<<(x)<; using vs = vector; using vvi = vector; using pii = pair; using vpii = vector; const int dx[4] = {1, 0,-1, 0}; const int dy[4] = {0, 1, 0,-1}; int gcd(int a, int b){if(a%b == 0){return(b);}else{return(gcd(b, a%b));}} int lcm(int a, int b){return a/gcd(a, b)*b;} template bool chmax(T &a,const T& b){if(a bool chmin(T &a,const T& b){if(a>b){a=b;return true;}return false;} //cout << fixed << setprecision(15); int N, M, K, H, W, X, Y; string S,T; const int INF = 1e18; const int mod = 1e9+7; signed main(){ cin >> N; int fst = N/2; while(1){ int dis = 0; int ndis = fst; while(ndis>0){ dis += ndis; if(dis == N){ COUT(fst); return 0; } if(dis > N) break; // 大きすぎ,次へ ndis /= 2; } fst++; } return 0; }