#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define fin(a) { cout << a << endl; return 0; }
#define debug(a) { cerr << #a << ": " << a << endl; }
#define endl '\n'
#define fi first
#define se second
using lint = long long;
using ld = long double;
using P = pair<int,int>;
using Pl = pair<lint,lint>;
template<class T> using V = vector<T>;
template<class T> using priq     = priority_queue<T>;
template<class T> using priq_inv = priority_queue<T, vector<T>, greater<T>>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
template<class T> T ceil(const T &a, const T &b) { return ((a)+(b)-1)/b; }
template<class T> bool chmin(T &a, T b) { if(a > b) { a = b; return 1; } return 0; }
template<class T> bool chmax(T &a, T b) { if(a < b) { a = b; return 1; } return 0; }
template<class T> void YesorNo(T x) { printf(x ? "Yes\n" : "No\n"); }
struct INF { template<class T> operator T() { return numeric_limits<T>::max() / 2; } } INF;

template<class T, class U> istream& operator>>(istream &in, pair<T,U> &p) {
    return in >> p.first >> p.second;
}
template<class T, class U> ostream& operator<<(ostream &out, const pair<T,U> &p) {
    return out << '{' << p.first << ',' << p.second << '}';
}
template<class T> istream& operator>>(istream &in, vector<T> &v) {
    for(auto &&e : v) in >> e;
    return in;
}
template<class T> ostream& operator<<(ostream &out, const vector<T> &v) {
    for(const auto &e : v) out << e << ' ';
    return out;
}

/*----------------------------------------------------------------------------------------------------*/


int main(){
    int n;
    cin >> n;
    int idx = 1;
    int now = 1;
    V<int> ans(n); ans[0] = 1;
    for(int i = 2; i <= n; i++) {
        if(i % idx == 0) {
            idx = i;
            now++;
        }
        ans[i-1] = now;
    }
    cout << ans << endl;
}
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define task "dfs"
#define pll pair<ll, ll>
#define pii pair<ll, pll>
#define fi first
#define se second
#define ull unsigned long long
using namespace std;
const ll mod = 1e9+7;
const ll N = 1e6+55;
vector<ll> adj[N], dx[N], dy[N];
vector<ll> kq;
string s;
ll n, m, t, k, b[N],  a[N], ans, tong, c[N], d[N], cnt;
pll p[N];
ll pw(ll k, ll n)
{
    ll total = 1;
    for(; n; n >>= 1)
    {
        if(n & 1)total = total * k % mod;
        k = k * k % mod;
    }
    return total;
}
ll cs(ll x)
{
    ll cnt = 0;
    while(x > 0)
    {
        ++cnt;
        x /= 10;
    }
    return cnt;
}
void sol()
{
    cin >> n;
    m = cs(n);
    k = 0;
    t = 1;
    for(int i = 1; i < m; i ++)
    {

        k = k *10 + 9;
        ans += (k - t + 1) * ((i-1) / 3);
        t *= 10;
    }
    cout << ans + ((m-1)/3) * (n - k);

}
int main()
{
    if(fopen(task".inp", "r")){
       freopen(task".inp", "r", stdin);
       freopen(task".out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int ntest = 1;
    //cin >> ntest;

    sol();
}
/*
4
2 3 6 5
1 2 8 8
4 7 4 5
2 5 1 2
https://codeforces.com/problemset/problem/1239/D
*/
