#include<bits/stdc++.h> using namespace std; int a; int main(){ cin>>a; while(a){ int s=0; while(a%2==0)a/=2,s++; cout<<(1<<s)<<endl; cin>>a; } return 0; }