Describe 데블스캠프2009/금요일/연습문제/ACM2453/김홍기 here
int b(n){int a=0;for(;;n/=2){if(n%2)a++;if(!n)break;}return a;}main(i,n){for(;;){scanf("%d",&n);if(!n)break;for(i=n+1;b(n)!=b(i);i++);printf("%d\n",i);}}