fork(6) download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <vector>
  4. using namespace std;
  5. vector<long long> v;
  6. void brute(long long num)
  7. {
  8. v.push_back(num);
  9. if (num > 1000000000)
  10. return;
  11. brute(num * 10 + 4);
  12. brute(num * 10 + 7);
  13. }
  14. int main()
  15. {
  16. ios::sync_with_stdio(false);
  17. brute(0);
  18. sort(v.begin(), v.end());
  19. v.resize(unique(v.begin(), v.end()) - v.begin());
  20. int n;
  21. cin >> n;
  22. cout << lower_bound(v.begin(), v.end(), n) - v.begin() << endl;
  23. return 0;
  24. }
Success #stdin #stdout 0s 3392KB
stdin
Standard input is empty
stdout
511