#include <bits/stdc++.h>
using namespace std;
int num(int i) {
  int s = 0;
  int p = 1;
  for (int j = 1; j <= 10; j++) {
    s += p * (i % 2);
    i /= 2;
    p *= 10;
  }
  return s;
}
int n, cont, i;
int main() {
  cin >> n;
  cont = 0;
  for (i = 1; i <= 1 << 10; i++) {
    if (num(i) <= n) {
      cont++;
    } else {
      cout << cont << endl;
      break;
    }
  }
  return 0;
}
