#include #define int long long #define endl '\n' using namespace std; int x; signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> x; if(!x)return cout << 0,0; cout << (1ll << (64 - __builtin_clzll(x) - __builtin_popcountll(x))) - 1; }