#include #include #include #include #include #include #include #include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define all(a) a.begin(), a.end() #define arr(a) a.rbegin(), a.rend() template bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;} template bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;} using ll = long long; //Konishii int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll d; cin >> d; ll v = d/2 + 1; while(true) { ll res = 0; ll c = v; while(c > 0) { res += c; if(res == d) { cout << v << endl; return 0; } else if(res > d) break; c /= 2; } v++; } }