#include<iostream>
#include<cmath>
using namespace std;
int main()
{
string s;
cin >> s;
int n = 0;
for(int i = s.length() - 1; i >= 0; i--)
n += (s[i] - '0') * pow(2, s.length() - i - 1);
cout << n;
return 0;
}
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
string s;
cin >> s;
int n = 0;
for(int i = s.length() - 1; i >= 0; i--)
n += (s[i] - '0') * pow(2, s.length() - i - 1);
cout << n;
return 0;
}