#include<bits/stdc++.h>
using namespace std;
int main()
{
    freopen("bai4_17.inp","r",stdin);
    freopen("bai4_17.out","w",stdout);
    int64_t n;
    cin>>n;
    int64_t a[100000];
    int64_t i=1;
    int64_t dem=0;
    while (n!=0)
    {
        a[i]=n%2;
        if(a[i]==1)
        {
            dem++;
        }
        n/=2;
        i++;
    }
    i--;
    for(int64_t j=1;j<=i;j++)
    {
        cout<<a[j];
    }
    sort(a+1,a+i+1);
    int64_t r=0;
    int64_t k=i-1;
    for(int64_t j=1;j<=dem;j++)
    {
        r+=pow(2,k);
        k--;
    }
    cout<<endl<<r;
}
