#include<stdio.h> #include<string.h> #include<stdlib.h> int main() { int t,n; while(scanf("%d",&n),n) { t=n&(-n); printf("%d\n",t); } //system("pause"); return 0; }