#include <bits/stdc++.h>

using namespace std;

ifstream fi ("bai4_17.inp");
ofstream fo ("bai4_17.out");

string s;
int num=0,num1=0;

void cdnp(int n){
  while (n>0){
    if (n%2==1){s='1'+s;num1++;}
    else s='0'+s;
    n=n/2;
  }
}

int main(){
    int n;
    fi>>n;
    cdnp(n);
    fo<<s<<endl;
    int sum=0,m=s.length();
    for (int i=1;i<=num1;i++) sum=sum+pow(2,m-i);
    fo<<sum;
}
