#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
char s[100];
int main(){
scanf("%s",&s);
int len = strlen(s),i,j;
long long a = 0,t = 0;
for(i=0;i<len;i++){
t = s[i] - '0';
for(j=1;j<=len-i-1;j++){
t = t * 2;
}
a = a + t;
}
printf("%lld",a);
return 0;
}
/**************************************************************
Problem: 1290
User: admin
Language: C
Result: Accepted
Time:18 ms
Memory:1144 kb
****************************************************************/