#include <bits/stdc++.h>
using namespace std;
ifstream f1("bai4_17.INP");
    ofstream f2("bai4_17.OUT");
   
int main()
{ long long x,d,dem=0,np=0,i;
f1>>x;
 string a[]={"0","1"},s="";
 while (x>0)
 { d=x%2;
 if (d==1){dem++;}
    s=a[d]+s;
    x=x/2;
 }

 for(i=s.length()-1;i>s.length()-dem-1;i--)
 {np=np+1*pow(2,i);
 }
 f2<<s<<endl<<np;
}
