#include <bits/stdc++.h>
using namespace std;
string n;
map<pair<string, int>, int> memo;
bool valid(string ss) {
  if (ss.size() < n.size()) return true;
  if (ss.size() == n.size() && ss <= n) return true;
  return false;
}
int bktk(string s, int rem) {
  if (s.size() >= n.size()) return 0;
  if (memo[make_pair(s, rem)] != 0) return memo[make_pair(s, rem)];
  int c1 = 0, c2 = 0;
  if (valid(s + '1')) c1 = bktk(s + '1', rem - 1) + 1;
  if (valid(s + '0')) c2 = bktk(s + '0', rem - 1) + 1;
  return memo[make_pair(s, rem)] = c1 + c2;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  cout << bktk("1", n.size()) + 1;
}
