#include <bits/stdc++.h>

using namespace std;

int n;

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++)
		cout << (int)log2(2 * i) << ' ';
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const double pi = acos(-1.0);
typedef long long ll;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    int  ans = 0;
    for(int i = 1; i <= n; i++) {
        int a = i;
        bool ok = true;
        while(a > 0) {
            int b = a % 10;
            if(b == 7) {
                ok = false;
            }
            a = a / 10;
        }
        int c = i;
        while(c > 0) {
            int d = c % 8;
            if(d == 7) {
                ok = false;
            }
            c = c / 8;
        }
        if(ok) {
            ans++;
        }
    }
    cout << ans << endl;
}