#include using namespace std; typedef long long int ll; int main() { cin.tie(0); ios::sync_with_stdio(0); ll n; cin >> n; cout << (1LL << __builtin_popcountll(n)) - 2 << endl; }