stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;

int main()

{

    ll n,g,x,t,h,k=0,f,l=0;

    cin>>n;

    if(n < 10)

    {

        cout<<n<<endl;

    }

    else if(n < 100)

    {

        cout<<"9"<<endl;

    }

    else if(n < 1000)

    {

        cout<<n-90<<endl;

    }

    else if(n < 10000)

    {

        cout<<"909"<<endl;

    }

    else if(n >= 10000 && n < 100000)

    {

        cout<<n-9090<<endl;

    }

    else if(n == 100000)

    {

        cout<<n-9091<<endl;

    }



}


// Faster C++ solution for the same problem (measured speedup: 5.262005806056423x):
#include<stdio.h>

int main()

{

    int n, i , x, y,sum = 0;



    scanf("%d", &n);



    if(n > 0 && n < 10)

    {

        for(i = 0; i < n ; i++)

        {

            sum++;

        }

        printf("%d\n",sum);

    }

    else if(n >= 10 && n <= 99)

        printf("9\n");

    else if(n > 99 && n < 1000)

    {

        x = n - 90;

        printf("%d\n",x);

    }

    else if(n > 999 && n < 10000)

    {

        printf("909\n");

    }

    else if(n > 9999 && n < 100000)

    {

        y = n - 9090 ;

        printf("%d\n", y);

    }

    else if(n > 99999)

        printf("90909\n");



    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#pragma GCC optimize ("Ofast")

#pragma GCC optimize("O3")

#define lll __int128_t

#define ll long long int

#define FOR(i,a,b) for(ll (i)=(a);i<(ll)(b);i++)

#define FORr(i,a,b) for(ll(i)=(a);i>(ll)(b);i--)

#define rep(i,n) FOR(i,0,n)

#define rep1(i,n) FOR(i,1,n)

#define outi(a) printf("%lld\n",(a))

#define case(i) cout << "Case " << i << ": ";

#define pb push_back

#define in(n) ll n = read();

#define show(arr) for(auto a : arr) cout << a << " "; cout << endl;

#define inp(arr, n) ll arr[n] ; rep(i,n) arr[i] = read();

#define mp make_pair

#define f first 

#define s second 

#define mod 1000000007

#define modu(a) if(a>=mod) a-=mod;

#define test int tt = read(); rep(i,tt) solve(i+1);

using namespace std;

inline ll read()

{

    ll x=0; static ll p; p=1; static char c; c=getchar();

    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }

    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }

    x*=p;

    return x;

}

int solve(int tt);

int main()

{

    //system("clear");

   // freopen("input.txt", "r", stdin);

   ll ans = 0;

  in(N);

  rep1(i,N+1)

  {

      ll q = log10(i)+1;

      if(q&1) ans++;

  }

  cout << ans <<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.421304076979339x):
#include<stdio.h>

int main()

{

    int n, i , x, y,sum = 0;



    scanf("%d", &n);



    if(n > 0 && n < 10)

    {

        for(i = 0; i < n ; i++)

        {

            sum++;

        }

        printf("%d\n",sum);

    }

    else if(n >= 10 && n <= 99)

        printf("9\n");

    else if(n > 99 && n < 1000)

    {

        x = n - 90;

        printf("%d\n",x);

    }

    else if(n > 999 && n < 10000)

    {

        printf("909\n");

    }

    else if(n > 9999 && n < 100000)

    {

        y = n - 9090 ;

        printf("%d\n", y);

    }

    else if(n > 99999)

        printf("90909\n");



    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define all(v)   v.begin(), v.end()

#define endl "\n";

#define pb push_back

#define F first

#define S second

#define JULEE_DO_THE_THING fast()

#define to_str to_string

#define isOdd(n)    (n&1)

#define LLMAX LLONG_MAX

#define LLMIN LLONG_MIN

#define IMIN INT_MIN

#define IMAX INT_MAX

#define pow POW



typedef long long ll;

typedef unsigned long long ull;

typedef long double ld;

typedef double dd;

typedef string str;

typedef vector<int> vecint;

typedef vector<ll> vecll;

typedef pair<int, int> pii;



void fast() {

	cin.tie(0);

	cout.tie(0);

	cin.sync_with_stdio(0);

}



bool compare(int &a, int &b) {

	return a > b;

}



ll numOfDigits(ll n) {

	if (!n)

		return 1;

	return (ll) (log10(n)) + 1;

}



ull POW(ll a, ll b);



/*



 */



ll BN();



int main() {

	JULEE_DO_THE_THING;

	//freopen("test cases\\.txt", "r", stdin) ;

    int n; cin>>n;

    ll ans= 0;

    for(int i=1; i<=n; i++){

        if(isOdd(numOfDigits(i)))ans++;

    }

    cout<<ans;

	return 0;

}



ll BN() {

	ll low = 0;

	ll up = 0;

	ll ans = 0;

	while (low <= up) {

		ll mid = ((low + up) / 2);

		if (mid) {

			ans = mid;

			low = mid + 1;

		} else

			up = mid - 1;

	}

	return ans;

}



ull POW(ll a, ll b) {

	ull res = 1;

	while (b > 0) {

		if (b & 1)

			res = res * a;

		a = a * a;

		b >>= 1;

	}

	return res;

}


// Faster C++ solution for the same problem (measured speedup: 5.242034192612844x):
#include<stdio.h>

int main()

{

 long long int n;

 scanf("%lld",&n);

 int i,count1=0;

 for(i=1;i<=n;i++)   

 {

     int temp;

     temp=i; 

     int count2=0;

     while(temp!=0)  

    {

      count2++;

      temp = temp/10;

    } 

    if(count2%2==1) 

       {

        count1++;

       }

 }

    

   printf("%d",count1); 

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>-



using namespace std;



int main()

{

    int n;

    cin>>n;

    int m=n;

    int num_dig=0;

    while( m > 0 )

    {

        num_dig++;

        m/=10;

    }

    if( num_dig == 1 )

        cout<<n<<endl;

    else if( num_dig == 2 )

        cout<<9<<endl;

    else if( num_dig == 3 )

        cout<<9 + (n - 100 + 1)<<endl;

    else if( num_dig ==  4)

        cout<<9+900<<endl;

    else if( num_dig == 5 )

        cout<<9+900+(n-10000+1)<<endl;

    else if( num_dig ==  6)

        cout<<9+900+90000<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.022947680204488x):
#include<stdio.h>

int main()

{

 long long int n;

 scanf("%lld",&n);

 int i,count1=0;

 for(i=1;i<=n;i++)   

 {

     int temp;

     temp=i; 

     int count2=0;

     while(temp!=0)  

    {

      count2++;

      temp = temp/10;

    } 

    if(count2%2==1) 

       {

        count1++;

       }

 }

    

   printf("%d",count1); 

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int digit(int n)

{

    int ret=0;

    while (n>0)

    {

        ret++;

        n/=10;

    }

    return ret;

}

int main()

{

    int n;

    cin>>n;

    int ans=0;

    for(int i=1; i<=n; i++)

    {

        if(digit(i)%2)

            ans ++;

    }

    cout<<ans<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.081587086227876x):
#include<stdio.h>

int main()

{

 long long int n;

 scanf("%lld",&n);

 int i,count1=0;

 for(i=1;i<=n;i++)   

 {

     int temp;

     temp=i; 

     int count2=0;

     while(temp!=0)  

    {

      count2++;

      temp = temp/10;

    } 

    if(count2%2==1) 

       {

        count1++;

       }

 }

    

   printf("%d",count1); 

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

#define LL long long int

#define DL double

#define MLL map<LL,LL>::iterator

#define MSL map<string,L>::iterator

#define MLS map<LL,string>::iterator

#define MSS map<string,string>::iterator

#define MCL map<char,LL>::iterator

#define SL set<LL>::iterator

#define SS set<string>::iterator

#define VL V<LL>::iterator

#define G getline

#define SZ size()

#define IN insert

#define C clear()

#define B begin()

#define F front()

#define T top()

#define E end()

#define EM emptm()

#define V vector

#define Q queue

#define DQ deque

#define PQ prioritm_queue

#define ST stack

#define FI first

#define MAn 1e18

#define MIN -1e18

#define SE second

#define PI acos(-1)

#define PS push

#define PP pop()

#define PSF push_front

#define PSB push_back

#define PPF pop_front()

#define PPB pop_back()

#define endl "\n"

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

V<LL>v;

map<LL,LL>u;

void Y()

{

    cout<<"Yes"<<endl;

}

void N()

{

    cout<<"No"<<endl;

}

int main()

{

    FAST;

    LL n,m,i,j,k,p,q,o,l,s,t,z=0,r;

    string a,b,c;

    cin>>n;

    k=0;

    for(i=1;i<=n;i++)

    {

        if(i<10 || (i>99&&i<1000) ||(i>9999 && i<100000))

        {

            k++;

        }

    }

    cout<<k<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.147074071863296x):
#include<stdio.h>

int main()

{

 long long int n;

 scanf("%lld",&n);

 int i,count1=0;

 for(i=1;i<=n;i++)   

 {

     int temp;

     temp=i; 

     int count2=0;

     while(temp!=0)  

    {

      count2++;

      temp = temp/10;

    } 

    if(count2%2==1) 

       {

        count1++;

       }

 }

    

   printf("%d",count1); 

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

main()

{

    int n,k,l=0,i;

    string s;

    cin>>n;

    for(i=1;i<=n;i++)

    {

        s=to_string(i);

        k=s.size();

        if(k%2!=0)

            l++;

    }

    cout<<l<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.44304232433632x):
#include<stdio.h>

int main()

{

 long long int n;

 scanf("%lld",&n);

 int i,count1=0;

 for(i=1;i<=n;i++)   

 {

     int temp;

     temp=i; 

     int count2=0;

     while(temp!=0)  

    {

      count2++;

      temp = temp/10;

    } 

    if(count2%2==1) 

       {

        count1++;

       }

 }

    

   printf("%d",count1); 

    return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main ()

{

    long long int a;

    cin>>a;

    if(a<=9)

        cout<<a-0<<endl;

    else if(a<=99)

        cout<<9<<endl;

    else if(a<=999)

    {

        cout<<((a-100)+10)<<endl;

    }

    else if(a<=9999)

    {

        cout<<909<<endl;

    }

    else if(a<=99999)

    {

        cout<<((a-10000)+910)<<endl;

    }

    else if(a<=999999)

    {

        cout<<90909<<endl;

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.02067463805946x):
#include<stdio.h>

int main()

{

 long long int n;

 scanf("%lld",&n);

 int i,count1=0;

 for(i=1;i<=n;i++)   

 {

     int temp;

     temp=i; 

     int count2=0;

     while(temp!=0)  

    {

      count2++;

      temp = temp/10;

    } 

    if(count2%2==1) 

       {

        count1++;

       }

 }

    

   printf("%d",count1); 

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{



long long a,b,c=0,d,e,g,h,i,j,k;

string arr;

cin>>a;

for(i=1;i<=a;i++)

{

arr=to_string(i);

if(arr.length()%2==1)

c++;



}

cout<<c;









}


// Faster C++ solution for the same problem (measured speedup: 5.437943659584148x):
#include<stdio.h>

int main()

{

 long long int n;

 scanf("%lld",&n);

 int i,count1=0;

 for(i=1;i<=n;i++)   

 {

     int temp;

     temp=i; 

     int count2=0;

     while(temp!=0)  

    {

      count2++;

      temp = temp/10;

    } 

    if(count2%2==1) 

       {

        count1++;

       }

 }

    

   printf("%d",count1); 

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define bye return 0

#define Yes cout << "Yes" << "\n"

#define No  cout << "No" << "\n"

#define YES cout << "YES" << "\n"

#define NO cout << "NO" << "\n"

using namespace std;

int main(){

	ios::sync_with_stdio(false);

    cin.tie(NULL);

    vector<int> v;

    set<int> s;

    int t, a, b, c, cnt=0;

    string str;

    cin >> t;



    for(int i=1; i<=t; ++i){

    	if(i>9 && i<100){

    		continue;

    	}else if(i>999 && i<10000){

    		continue;

    	}else if(i>99999 && i<=1000000){

    		continue;

    	}else{

    	cnt++;

    	}

    }



    cout << cnt << "\n";



    

    



   bye;



}

// Faster C++ solution for the same problem (measured speedup: 5.103600305651085x):
#include<stdio.h>

int main()

{

 long long int n;

 scanf("%lld",&n);

 int i,count1=0;

 for(i=1;i<=n;i++)   

 {

     int temp;

     temp=i; 

     int count2=0;

     while(temp!=0)  

    {

      count2++;

      temp = temp/10;

    } 

    if(count2%2==1) 

       {

        count1++;

       }

 }

    

   printf("%d",count1); 

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long int

#define pii <pair<ll,ll>>

using namespace std;



int digit(ll p)

{

    ll c=0;

    while(p>0)

    {

        c++;

        p=p/10;

    }

    return c;

}



void solve()

{

    ll n;

     cin >> n;

     ll ans=0;

     for(int i=1;i<=n;i++)

     {

         if(digit(i)%2!=0)

            ans++;

     }

     cout << ans << endl;

}



int main()

{

     solve();

     return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.0754584180392035x):
#include<stdio.h>

int main()

{

 long long int n;

 scanf("%lld",&n);

 int i,count1=0;

 for(i=1;i<=n;i++)   

 {

     int temp;

     temp=i; 

     int count2=0;

     while(temp!=0)  

    {

      count2++;

      temp = temp/10;

    } 

    if(count2%2==1) 

       {

        count1++;

       }

 }

    

   printf("%d",count1); 

    return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

  int n, tmp, c=0, ans;

  cin >> n;

  tmp = n;

  while(tmp)

  {

      tmp /= 10;

      c++;

  }

  if(c == 1)

    ans = n;

  else if(c == 2)

    ans = 9;

  else if(c == 3)

    ans = n-99+9;

  else if(c == 4)

    ans = 909;

  else if(c == 5)

    ans = n-9999+909;

  else if(c == 6)

    ans = 90909;

  

  cout << ans <<"\n";

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.028275565158809x):
#include<stdio.h>

int main()

{

 long long int n;

 scanf("%lld",&n);

 int i,count1=0;

 for(i=1;i<=n;i++)   

 {

     int temp;

     temp=i; 

     int count2=0;

     while(temp!=0)  

    {

      count2++;

      temp = temp/10;

    } 

    if(count2%2==1) 

       {

        count1++;

       }

 }

    

   printf("%d",count1); 

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

void debug() {cout<<endl;}

template<typename T,typename... Args>

void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}

#define forn(i,a,b) for(int i=a;i<b;++i)

#define SZ(x) int(x.size())

#define pb push_back

#define F first

#define S second

#define endl "\n"

typedef long long ll;

typedef pair<int, int> pii;



int main() {

    ios::sync_with_stdio(0); cin.tie(0);

    int n;

    cin >> n;

    int ans = 0;

    forn(i, 1, n+1) {

        string s = to_string(i);

        ans += SZ(s)&1;

    }

    cout << ans << endl;

}


// Faster C++ solution for the same problem (measured speedup: 5.47400175401545x):
#include<stdio.h>

int main()

{

 long long int n;

 scanf("%lld",&n);

 int i,count1=0;

 for(i=1;i<=n;i++)   

 {

     int temp;

     temp=i; 

     int count2=0;

     while(temp!=0)  

    {

      count2++;

      temp = temp/10;

    } 

    if(count2%2==1) 

       {

        count1++;

       }

 }

    

   printf("%d",count1); 

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){

	int n; cin>>n;

	int ans=0;

	for(int i=1; i<=n; i++){

		int aux = (log10(i)+1);

		if(aux%2!=0)

			ans++;

	}

	cout<<ans<<endl;

}


// Faster C++ solution for the same problem (measured speedup: 5.1863013116997285x):
#include<stdio.h>

int main()

{

 long long int n;

 scanf("%lld",&n);

 int i,count1=0;

 for(i=1;i<=n;i++)   

 {

     int temp;

     temp=i; 

     int count2=0;

     while(temp!=0)  

    {

      count2++;

      temp = temp/10;

    } 

    if(count2%2==1) 

       {

        count1++;

       }

 }

    

   printf("%d",count1); 

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define all(v)   v.begin(), v.end()

#define endl "\n";

#define pb push_back

#define F first

#define S second

#define JULEE_DO_THE_THING fast()

#define to_str to_string

#define isOdd(n)    (n&1)

#define LLMAX LLONG_MAX

#define LLMIN LLONG_MIN

#define IMIN INT_MIN

#define IMAX INT_MAX

#define pow POW



typedef long long ll;

typedef unsigned long long ull;

typedef long double ld;

typedef double dd;

typedef string str;

typedef vector<int> vecint;

typedef vector<ll> vecll;

typedef pair<int, int> pii;



void fast() {

	cin.tie(0);

	cout.tie(0);

	cin.sync_with_stdio(0);

}



bool compare(int &a, int &b) {

	return a > b;

}



ll numOfDigits(ll n) {

	if (!n)

		return 1;

	return (ll) (log10(n)) + 1;

}



ull POW(ll a, ll b);



/*



 */



ll BN();



int main() {

	JULEE_DO_THE_THING;

	//freopen("test cases\\.txt", "r", stdin) ;

    int n; cin>>n;

    ll ans= 0;

    for(int i=1; i<=n; i++){

        if(isOdd(numOfDigits(i)))ans++;

    }

    cout<<ans;

	return 0;

}



ll BN() {

	ll low = 0;

	ll up = 0;

	ll ans = 0;

	while (low <= up) {

		ll mid = ((low + up) / 2);

		if (mid) {

			ans = mid;

			low = mid + 1;

		} else

			up = mid - 1;

	}

	return ans;

}



ull POW(ll a, ll b) {

	ull res = 1;

	while (b > 0) {

		if (b & 1)

			res = res * a;

		a = a * a;

		b >>= 1;

	}

	return res;

}


// Faster C++ solution for the same problem (measured speedup: 5.423510684672887x):
#include<stdio.h>



int main()

{

    int N, i, s=1, count=0;



    scanf("%d", &N);



    for(i=1; i<=N; i++){

        if(1*s <= i && i < 10*s){

            count++;

            if(i == (10*s-1))

                s *=100;

        }

    }



    printf("%d\n", count);



    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>-



using namespace std;



int main()

{

    int n;

    cin>>n;

    int m=n;

    int num_dig=0;

    while( m > 0 )

    {

        num_dig++;

        m/=10;

    }

    if( num_dig == 1 )

        cout<<n<<endl;

    else if( num_dig == 2 )

        cout<<9<<endl;

    else if( num_dig == 3 )

        cout<<9 + (n - 100 + 1)<<endl;

    else if( num_dig ==  4)

        cout<<9+900<<endl;

    else if( num_dig == 5 )

        cout<<9+900+(n-10000+1)<<endl;

    else if( num_dig ==  6)

        cout<<9+900+90000<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.196839511373618x):
#include<stdio.h>



int main()

{

    int N, i, s=1, count=0;



    scanf("%d", &N);



    for(i=1; i<=N; i++){

        if(1*s <= i && i < 10*s){

            count++;

            if(i == (10*s-1))

                s *=100;

        }

    }



    printf("%d\n", count);



    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int digit(int n)

{

    int ret=0;

    while (n>0)

    {

        ret++;

        n/=10;

    }

    return ret;

}

int main()

{

    int n;

    cin>>n;

    int ans=0;

    for(int i=1; i<=n; i++)

    {

        if(digit(i)%2)

            ans ++;

    }

    cout<<ans<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.257508983075824x):
#include<stdio.h>



int main()

{

    int N, i, s=1, count=0;



    scanf("%d", &N);



    for(i=1; i<=N; i++){

        if(1*s <= i && i < 10*s){

            count++;

            if(i == (10*s-1))

                s *=100;

        }

    }



    printf("%d\n", count);



    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

#define LL long long int

#define DL double

#define MLL map<LL,LL>::iterator

#define MSL map<string,L>::iterator

#define MLS map<LL,string>::iterator

#define MSS map<string,string>::iterator

#define MCL map<char,LL>::iterator

#define SL set<LL>::iterator

#define SS set<string>::iterator

#define VL V<LL>::iterator

#define G getline

#define SZ size()

#define IN insert

#define C clear()

#define B begin()

#define F front()

#define T top()

#define E end()

#define EM emptm()

#define V vector

#define Q queue

#define DQ deque

#define PQ prioritm_queue

#define ST stack

#define FI first

#define MAn 1e18

#define MIN -1e18

#define SE second

#define PI acos(-1)

#define PS push

#define PP pop()

#define PSF push_front

#define PSB push_back

#define PPF pop_front()

#define PPB pop_back()

#define endl "\n"

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

V<LL>v;

map<LL,LL>u;

void Y()

{

    cout<<"Yes"<<endl;

}

void N()

{

    cout<<"No"<<endl;

}

int main()

{

    FAST;

    LL n,m,i,j,k,p,q,o,l,s,t,z=0,r;

    string a,b,c;

    cin>>n;

    k=0;

    for(i=1;i<=n;i++)

    {

        if(i<10 || (i>99&&i<1000) ||(i>9999 && i<100000))

        {

            k++;

        }

    }

    cout<<k<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.325263094027871x):
#include<stdio.h>



int main()

{

    int N, i, s=1, count=0;



    scanf("%d", &N);



    for(i=1; i<=N; i++){

        if(1*s <= i && i < 10*s){

            count++;

            if(i == (10*s-1))

                s *=100;

        }

    }



    printf("%d\n", count);



    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

main()

{

    int n,k,l=0,i;

    string s;

    cin>>n;

    for(i=1;i<=n;i++)

    {

        s=to_string(i);

        k=s.size();

        if(k%2!=0)

            l++;

    }

    cout<<l<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.44360558035452x):
#include<stdio.h>



int main()

{

    int N, i, s=1, count=0;



    scanf("%d", &N);



    for(i=1; i<=N; i++){

        if(1*s <= i && i < 10*s){

            count++;

            if(i == (10*s-1))

                s *=100;

        }

    }



    printf("%d\n", count);



    return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main ()

{

    long long int a;

    cin>>a;

    if(a<=9)

        cout<<a-0<<endl;

    else if(a<=99)

        cout<<9<<endl;

    else if(a<=999)

    {

        cout<<((a-100)+10)<<endl;

    }

    else if(a<=9999)

    {

        cout<<909<<endl;

    }

    else if(a<=99999)

    {

        cout<<((a-10000)+910)<<endl;

    }

    else if(a<=999999)

    {

        cout<<90909<<endl;

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.1944877776940395x):
#include<stdio.h>



int main()

{

    int N, i, s=1, count=0;



    scanf("%d", &N);



    for(i=1; i<=N; i++){

        if(1*s <= i && i < 10*s){

            count++;

            if(i == (10*s-1))

                s *=100;

        }

    }



    printf("%d\n", count);



    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{



long long a,b,c=0,d,e,g,h,i,j,k;

string arr;

cin>>a;

for(i=1;i<=a;i++)

{

arr=to_string(i);

if(arr.length()%2==1)

c++;



}

cout<<c;









}


// Faster C++ solution for the same problem (measured speedup: 5.4385063879831534x):
#include<stdio.h>



int main()

{

    int N, i, s=1, count=0;



    scanf("%d", &N);



    for(i=1; i<=N; i++){

        if(1*s <= i && i < 10*s){

            count++;

            if(i == (10*s-1))

                s *=100;

        }

    }



    printf("%d\n", count);



    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define bye return 0

#define Yes cout << "Yes" << "\n"

#define No  cout << "No" << "\n"

#define YES cout << "YES" << "\n"

#define NO cout << "NO" << "\n"

using namespace std;

int main(){

	ios::sync_with_stdio(false);

    cin.tie(NULL);

    vector<int> v;

    set<int> s;

    int t, a, b, c, cnt=0;

    string str;

    cin >> t;



    for(int i=1; i<=t; ++i){

    	if(i>9 && i<100){

    		continue;

    	}else if(i>999 && i<10000){

    		continue;

    	}else if(i>99999 && i<=1000000){

    		continue;

    	}else{

    	cnt++;

    	}

    }



    cout << cnt << "\n";



    

    



   bye;



}

// Faster C++ solution for the same problem (measured speedup: 5.280284288684106x):
#include<stdio.h>



int main()

{

    int N, i, s=1, count=0;



    scanf("%d", &N);



    for(i=1; i<=N; i++){

        if(1*s <= i && i < 10*s){

            count++;

            if(i == (10*s-1))

                s *=100;

        }

    }



    printf("%d\n", count);



    return 0;

}