#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    int k=0,t=1;
    cin>>s;
    for(int i=s.size()-1;i>=0;i--){
        k=k+(s[i]-48)*t;
        t*=2;
    }       
    cout<<k;                                                      
    return 0;
} 
/**************************************************************
	Problem: 1290
	User: lijinkai
	Language: C++
	Result: Accepted
	Time:16 ms
	Memory:2076 kb
****************************************************************/