/* -*- coding: utf-8 -*- * * 2853.cc: No.2853 A + B Problem - yukicoder */ #include #include using namespace std; /* constant */ const int BN = 60; /* typedef */ using ll = long long; /* global variables */ /* subroutines */ /* main */ int main() { ll n; scanf("%lld", &n); int c = 0; for (; n > 0; n >>= 1) if (n & 1) c++; printf("%lld\n", (1LL << c) - 2); return 0; }