import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main
{
  
  public static void main(String[] args) throws IOException
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int N=Integer.parseInt(br.readLine());
    int ans=0;
    if(N<100){
      ans=Math.min(N,9);
    }else if (N<10000){
      ans=9+Math.min(N-99,900);
    }else{
      ans=9+900+Math.min(N-9999,90000);
    }
    System.out.println(ans);
  }
}


 import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main
{
  
  public static void main(String[] args) throws IOException
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int N=Integer.parseInt(br.readLine());
    int ans=0;
    if(N<100){
      ans=Math.min(N,9);
    }else if (N<10000){
      ans=9+Math.min(N-99,900);
    }else{
      ans=9+900+Math.min(N-9999,90000);
    }
    System.out.println(ans);
  }
} Main public static void main(String[] args) throws IOException
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int N=Integer.parseInt(br.readLine());
    int ans=0;
    if(N<100){
      ans=Math.min(N,9);
    }else if (N<10000){
      ans=9+Math.min(N-99,900);
    }else{
      ans=9+900+Math.min(N-9999,90000);
    }
    System.out.println(ans);
  } main {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int N=Integer.parseInt(br.readLine());
    int ans=0;
    if(N<100){
      ans=Math.min(N,9);
    }else if (N<10000){
      ans=9+Math.min(N-99,900);
    }else{
      ans=9+900+Math.min(N-9999,90000);
    }
    System.out.println(ans);
  } BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int N=Integer.parseInt(br.readLine()); N Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int ans=0; ans 0 if(N<100){
      ans=Math.min(N,9);
    }else if (N<10000){
      ans=9+Math.min(N-99,900);
    }else{
      ans=9+900+Math.min(N-9999,90000);
    } N<100 N 100 {
      ans=Math.min(N,9);
    } ans=Math.min(N,9) ans Math.min(N,9) Math.min Math N 9 if (N<10000){
      ans=9+Math.min(N-99,900);
    }else{
      ans=9+900+Math.min(N-9999,90000);
    } N<10000 N 10000 {
      ans=9+Math.min(N-99,900);
    } ans=9+Math.min(N-99,900) ans 9+Math.min(N-99,900) 9 Math.min(N-99,900) Math.min Math N-99 N 99 900 {
      ans=9+900+Math.min(N-9999,90000);
    } ans=9+900+Math.min(N-9999,90000) ans 9+900+Math.min(N-9999,90000) 9+900+Math.min(N-9999,90000) 9 900 Math.min(N-9999,90000) Math.min Math N-9999 N 9999 90000 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main
{
  
  public static void main(String[] args) throws IOException
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int N=Integer.parseInt(br.readLine());
    int ans=0;
    if(N<100){
      ans=Math.min(N,9);
    }else if (N<10000){
      ans=9+Math.min(N-99,900);
    }else{
      ans=9+900+Math.min(N-9999,90000);
    }
    System.out.println(ans);
  }
} public class Main
{
  
  public static void main(String[] args) throws IOException
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int N=Integer.parseInt(br.readLine());
    int ans=0;
    if(N<100){
      ans=Math.min(N,9);
    }else if (N<10000){
      ans=9+Math.min(N-99,900);
    }else{
      ans=9+900+Math.min(N-9999,90000);
    }
    System.out.println(ans);
  }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main
{
  
  public static void main(String[] args) throws IOException
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int N=Integer.parseInt(br.readLine());
    int ans=0;
    if(N<100){
      ans=Math.min(N,9);
    }else if (N<10000){
      ans=9+Math.min(N-99,900);
    }else{
      ans=9+900+Math.min(N-9999,90000);
    }
    System.out.println(ans);
  }
}



