#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     if (n & 1)       cout << (n - 1) / 2;     else {       int v = 1;       while (v * 2 <= n) v = v * 2;       cout << (n - v) / 2;     }     return 0;   }   