#include <iostream>
#include <vector>
#include <set>
#include <cstring>
using namespace std;

int main() {
    string s;
    cin >> s;
    
    int power_of_two = 1;
    int number = 0;
    for(int i = s.size() - 1; i >= 0; i--) {
        if(s[i] == '1') {
            number += power_of_two;
        }
        power_of_two *= 2;
    }
    cout << number << endl;
    return 0;
}
