#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
if(n%2==1)
{
cout<<0;
return 0;
}
n/=2;
while(n%2)
{
n/=2;
if(n==1)
break;
}
cout<<n;
return 0;
}