package com._163;
import java.util.Scanner;
public class NumFeature {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x = in.nextInt();
int count = 1; //第几位
int bin ; //输出的二进制
int sum = 0;
int power =1; //表示2的几次方
while( x>0 )
{
int y = x % 10; //y 是 x的最后一位数
//个位数取余数 == 位数取余数
if( y % 2 == count % 2 )
{
bin = 1;
}
else
{
bin = 0;
}
//位数迭代,1234567等差递增
++count;
//count最后输入会比输入数x的位数多1
System.out.println(count);
//循环条件判断
x = x / 10;
//计算最后结果 1*1 1*2 1*4 1*8
sum = sum+bin*power;
power = power*2;
//Math.pow(bin,count-1)幂次方,浮点数,用不了
}
System.out.println(sum);
}
}