#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); // freopen("even.in","r",stdin); // freopen("even.out","w",stdout); cin >> x; int tx = x,ans = 1; while(x)ans *= ((x & 1) + 1),x >>= 1; cout << (tx + 1) - ans; }