#include <bits/stdc++.h>

#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define call(a) (a).cbegin(),(a).cend()
#define rep(i,n) for(ll i=0,i##_len=(n);i<i##_len;i++)
#define brep(i,a,b) for(ll i=(a),i##_len=(b);i<=i##_len;i++)
#define rrep(i,n) ll i=(n);ll now=-1;while(i--&&(now++||1))
#define xrep(i,n) for(ll i=1,i##_len=(n);i<=i##_len;i++)
#define Yes(n) cout<<((n)?YES:NO)<<'\n'
#define rYes(n) cout<<((n)?YES:NO)<<'\n';return
#define co(n) cout<<(n)<<'\n'
#define rco(n) cout<<(n)<<'\n';return
#define Sort(v) sort(all(v))
#define rSort(v) sort(all(v)); reverse(all(v))
#define Unique(v) (v).erase(unique(all(v)),(v).end())
#define eb emplace_back
#define RR return r

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vbl = vector<bool>;
using vint = vector<int>;
using vvll = vector<vll>;
using vstr = vector<string>;

const ll INF = 1e18;

// --- functions which take 1 argument ---
static inline void ignore_ret(int x){x++;}
template<class T>inline int sgn(const T&x){return (x>0)-(x<0);}
template<class T>inline ll factorial(const T&n){if(n==0)return 1;ll r=1;brep(i,2,n)r*=i;RR;}
template<class T>inline map<T,T> factorize(const T&n){map<T,T>r;for(T i=2;i*i<=n;i++){while(n%i==0){r[i]++;n/=i;}}if(n!=1)r[n]=1;RR;}
template<class T>inline vector<T> divisor(const T&n){vector<T>r;for(T i=1;i*i<=n;i++){if(!(n%i)){r.eb(i);if(i*i!=n)r.eb(n/i);}}Sort(r);RR;}

// --- functions which take 2 arguments ---
template<class T>inline bool chmax(T&a,const T&b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T&a,const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline T mod_positive(const T&x,const T&y){return ((x<0)?(x%y)+y:x%y);}
template<class T>inline T nPr(const T&n,const T&k){if(n<k||n<0||k<0)return 0;T r=1;brep(i,n-k+1,n)r*=i;RR;}
template<class T>inline T nCr(const T&n,const T&k){if(n<k||n<0||k<0)return 0;T r=1;k=min(k,n-k);brep(i,n-k+1,n)r*=i;return r/factorial(k);}

// --- functions which take vector(s) as argument(s) ---
template<class T>inline void print(const T&v){cout<<"[ ";for(auto x:v)cout<<x<<' ';cout<<"]\n";}
template<class T>inline void print_d(const T&v){for(auto x:v)cout<<x;cout<<'\n';}
template<class T>inline void print_all(const T&v){for(auto x:v)cout<<x<<'\n';}
template<class T>inline T min(const vector<T>&v){return *min_element(all(v));}
template<class T>inline T max(const vector<T>&v){return *max_element(all(v));}
template<class T>inline ll sum(const T&v){return reduce(all(v),0LL);}
template<class T>inline T gcd(const vector<T>&v){T r=v[0];brep(i,1,(ll)v.size()-1)r=gcd(r,v[i]);RR;}
template<class T>inline T lcm(const vector<T>&v){T r=v[0];brep(i,1,(ll)v.size()-1)r=lcm(r,v[i]);RR;}
template<class T>inline double abs(const vector<T>&v){return sqrt(reduce(all(v),0.0,[](T s,T v){return s+=v*v;}));}
template<class T>inline T vector_add(const T&u,const T&v){ll s=u.size();T r;rep(i,s)r.eb(u[i]+v[i]);RR;}
template<class T>inline T vector_subtract(const T&u,const T&v){ll s=u.size();T r;rep(i,s)r.eb(u[i]-v[i]);RR;}
template<class T>inline T dot_product(const vector<T>&u,const vector<T>&v){T r=0;if(u.size()<v.size())RR;rep(i,u.size())r+=u[i]*v[i];RR;}
template<class T>inline T cross_product(const T&u,const T&v){T r(3);r[0]=u[1]*v[2]-u[2]*v[1];r[1]=u[2]*v[0]-u[0]*v[2];r[2]=u[0]*v[1]-u[1]*v[0];RR;}

// --- functions which take set(s) as argument(s) ---
template<class T>inline T min(const set<T>&v){return *min_element(all(v));}
template<class T>inline T max(const set<T>&v){return *max_element(all(v));}
template<class T>inline T gcd(const set<T>&v){T r=0;for(T x:v)r=(r==0)?x:gcd(r,x);RR;}
template<class T>inline T lcm(const set<T>&v){T r=0;for(T x:v)r=(r==0)?x:lcm(r,x);RR;}


// --- Template ends here ---

void solve(ll N) {
  ll ans;

  if (N < 10) {
    ans = N;
  } else if (N < 100) {
    ans = 9;
  } else if (N < 1'000) {
    ans = 9 + (N - 99);
  } else if (N < 10'000) {
    ans = 9 + 900;
  } else if (N < 100'000){
    ans = 9 + 900 + (N - 9'999);
  } else {
    ans = 9 + 900 + 90'000;
  }

  cout << ans << '\n';
}

int main() {
  ll N;
  ignore_ret(scanf("%lld",&N));
  solve(N);
  return 0;
}


Measured memory_bytes: 256