#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;} #define wt(v) {ulong _z=v;do*--wp=_z%10+48;while(_z/=10);} #define rrep(v,e) for(long v=e;v--;) typedef unsigned long ulong; char wbuf[1<<25]; long f0(){ char rbuf[64]; read(0,rbuf,sizeof rbuf); char*rp=rbuf; rd(n); return n; } int main(){ ulong n=f0(); if(!n){ write(1,"-1",2); _exit(0); } long c=0; char*wp=wbuf+sizeof wbuf; for(ulong i=1ul<<50;i>>=1;){ if(n&i){ *--wp=' '; wt(i); n^=(i<<1)-1; ++c; } } *--wp=' '; wt(c); write(1,wp,wbuf+sizeof wbuf-wp); _exit(0); }