#include #include using namespace std; constexpr uint16_t pop_count(uint64_t a) noexcept { uint16_t ans = UINT16_C(0); for (; a != UINT64_C(0); a >>= UINT64_C(1)) if(a & UINT64_C(1)) ++ans; return ans; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); uint64_t N; cin >> N; cout << ((UINT64_C(1) << pop_count(N)) - 2) << '\n'; return 0; }