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

////////////////////////////////////////////////////////////////////////////<editor-fold desc="macros">
//#define mod 9999991
long mod=9999991;
#define endl "\n"
#define long long long
#define all(v) (v).begin(),(v).end()
#define makeset(v) (v).resize(unique((v).begin(),(v).end())-(v).begin())
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define filein freopen("input.txt", "r", stdin);
#define fileout freopen("output.txt", "w", stdout);
#define getline(x) getline(cin,x)
#define makelower(s) transform(s.begin(),s.end(),s.begin(),::tolower)
bool sortby(pair<int,int> a,pair<int,int> b){
    double x=(double )a.first/a.second;
    double y=(double )b.first/b.second;
    return x<y;}
long Pow(long x, long y) {
    if(y == 0)return 1;
    long res=Pow(x,y/2)%mod;
    res=(res*res)%mod;
    if(y&1)res=(res*x)%mod;
    return res;
}
#define printcase(x)  cout<<"Case "<<in++<<": "<<x<<endl
#define memset(a,b) memset(a,b,sizeof(a))
#define print1d(ary) cout<<"[";for(auto x:(ary)){cout<<x<<",";}cout<<"]"<<endl;
#define print2d(x) for(int m = 0; m <sizeof(x)/sizeof(x[0]) ; ++m){for(int l = 0; l <sizeof(x[0])/sizeof(x[0][0]) ; ++l){cout<<x[m][l]<<" ";}cout<<endl;}
#define pi acos(-1)
#define esp 1e-9
////////////////////////////////////////////////////////////////////////////</editor-fold>
long t,n,m,f=0,ans,a,b,q;
long tmp;

struct point{
    double x,y;
    point(){x=y=0.0;}
    point(double _x,double _y):x(_x),y(_y){}
    bool operator==(point other) const {
        return (fabs(x-other.x)<esp && fabs(y-other.y)<esp);
    }
    bool operator<(point other) const {
        if(fabs(x-other.x)>esp){
            return x<other.x;
        }
        return y<other.y;
    }
};
struct vec{
    double x,y;
    vec(double _x, double _y) : x(_x), y(_y) {}
};
struct line{
    double a,b,c;
    line() {a=b=c=1.0;}
    line(double _a, double _b, double _c) : a(_a), b(_b), c(_c) {}
};
double distOfPoint(point p1,point p2){
    return hypot(p1.x-p2.x,p1.y-p2.y);
}
line pointToLine(point p1,point p2){
    line l;
    if(fabs(p1.x-p2.x)<esp){
        l.a=1.0;l.b=0.0;l.c=-p1.x;
    }
    else{
        l.a=-((double)(p1.y-p2.y)/(p1.x-p2.x));
        l.b=1.0;
        l.c=-(l.a*p1.x+p1.y);
    }
    return l;
}
vec toVec(point p1,point p2){
    return {p2.x-p1.x,p2.y-p1.y};
}
vec scale(vec v,double s){
    return {v.x*s,v.y*s};
}
point translate(point p,vec v){
    return {p.x+v.x,p.y+v.y};
}
double dot(vec v1,vec v2){
    return v1.x*v2.x+v1.y*v2.y;
}
double norm_sq(vec v){
    return v.x*v.x+v.y*v.y;
}

double distToLineSeg(point p1,point p2,point z,point &c){
    vec p1p2=toVec(p1,p2),p1z=toVec(p1,z);
    double u=dot(p1p2,p1z)/norm_sq(p1p2);
    if(u<0){
        c=p1;
        return distOfPoint(z,p1);
    }
    if(u>1){
        c=p2;
        return distOfPoint(z,p2);
    }
    c=translate(p1,scale(p1p2,u));
    return distOfPoint(z,c);
}

int main() {
///<editor-fold desc="ios">
    IOS
#ifdef _AD_
    filein //fileout
#endif
///</editor-fold>
    int in=1,o;
    long c,d,count=0;
    string s;
    cin>>n;
    for(int i = 1; ; ++i){
        s=to_string(i)+to_string(i);
        m=stoll(s);
        if(m<=n){
            count++;
            //cout<<m<<endl;
        }
        else{
            break;
        }
    }
    cout<<count<<endl;
}
#include <bits/stdc++.h>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
using ld = long double;
const ul mod = 1000000007;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    ll loop = 1100000;
    ll ans = 0;
    repd(i, 1, loop) {
        string temp = to_string(i);
        temp += temp;
        ll num = stoll(temp);
        if (num <= n) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

