#include using namespace std; using ll = int_fast64_t; constexpr int mod = 1e9 + 7; constexpr int inf = (1 << 30) - 1; constexpr ll infll = (1LL << 61) - 1; #define fast() ios::sync_with_stdio(false), cin.tie(nullptr) #define set_digit(N) cout << fixed << setprecision((N)) #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") ll func(ll x, int k) { ll sum = 0; for (int i = 0; i < k; i++) { sum += x; x /= 2; } return sum; } int main() { ll D; cin >> D; vector ans; for (ll i = 0; i <= log2(D) + 1; i++) { ll ng = 0, ok = D; while (ok - ng > 1) { ll mid = (ok + ng) / 2; if (func(mid, i) >= D) { ok = mid; } else { ng = mid; } } if (func(ok, i) == D) ans.push_back(ok); } if (ans.empty()) { cout << -1 << "\n"; } else { cout << *min_element(ans.begin(), ans.end()) << "\n"; } }