#include <bits/stdc++.h>
using namespace std;
int cn = 0;
string s, t;
void dfs(string a) {
  if (a.size() == s.size()) {
    if (a <= s && a > t) {
      cn++;
    }
    return;
  }
  dfs(a + '1'), dfs(a + '0');
  return;
}
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); ++i) {
    t += '0';
    if (s[i] > '1')
      for (int j = i; j < s.size(); ++j) s[j] = '1';
  }
  dfs("");
  cout << cn;
}
