import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int input = sc.nextInt();
    int output;
    if(input < 10){
      output = input;
    }else if(input < 100){
      output = 9;
    }else if(input < 1000){
      output = 9 + input - 99;
    }else if(input < 10000){
      output = 9 + 900;
    }else if(input < 100000){
      output = 9 + 900 + input - 9999;
    }else{
      output = 90909;
    }
    System.out.println(output);
  }
} import java.util.Scanner; Scanner java.util class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int input = sc.nextInt();
    int output;
    if(input < 10){
      output = input;
    }else if(input < 100){
      output = 9;
    }else if(input < 1000){
      output = 9 + input - 99;
    }else if(input < 10000){
      output = 9 + 900;
    }else if(input < 100000){
      output = 9 + 900 + input - 9999;
    }else{
      output = 90909;
    }
    System.out.println(output);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int input = sc.nextInt();
    int output;
    if(input < 10){
      output = input;
    }else if(input < 100){
      output = 9;
    }else if(input < 1000){
      output = 9 + input - 99;
    }else if(input < 10000){
      output = 9 + 900;
    }else if(input < 100000){
      output = 9 + 900 + input - 9999;
    }else{
      output = 90909;
    }
    System.out.println(output);
  } main {
    Scanner sc = new Scanner(System.in);
    int input = sc.nextInt();
    int output;
    if(input < 10){
      output = input;
    }else if(input < 100){
      output = 9;
    }else if(input < 1000){
      output = 9 + input - 99;
    }else if(input < 10000){
      output = 9 + 900;
    }else if(input < 100000){
      output = 9 + 900 + input - 9999;
    }else{
      output = 90909;
    }
    System.out.println(output);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int input = sc.nextInt(); input sc.nextInt() sc.nextInt sc int output; output if(input < 10){
      output = input;
    }else if(input < 100){
      output = 9;
    }else if(input < 1000){
      output = 9 + input - 99;
    }else if(input < 10000){
      output = 9 + 900;
    }else if(input < 100000){
      output = 9 + 900 + input - 9999;
    }else{
      output = 90909;
    } input < 10 input 10 {
      output = input;
    } output = input output input if(input < 100){
      output = 9;
    }else if(input < 1000){
      output = 9 + input - 99;
    }else if(input < 10000){
      output = 9 + 900;
    }else if(input < 100000){
      output = 9 + 900 + input - 9999;
    }else{
      output = 90909;
    } input < 100 input 100 {
      output = 9;
    } output = 9 output 9 if(input < 1000){
      output = 9 + input - 99;
    }else if(input < 10000){
      output = 9 + 900;
    }else if(input < 100000){
      output = 9 + 900 + input - 9999;
    }else{
      output = 90909;
    } input < 1000 input 1000 {
      output = 9 + input - 99;
    } output = 9 + input - 99 output 9 + input - 99 9 + input 9 input 99 if(input < 10000){
      output = 9 + 900;
    }else if(input < 100000){
      output = 9 + 900 + input - 9999;
    }else{
      output = 90909;
    } input < 10000 input 10000 {
      output = 9 + 900;
    } output = 9 + 900 output 9 + 900 9 900 if(input < 100000){
      output = 9 + 900 + input - 9999;
    }else{
      output = 90909;
    } input < 100000 input 100000 {
      output = 9 + 900 + input - 9999;
    } output = 9 + 900 + input - 9999 output 9 + 900 + input - 9999 9 + 900 + input 9 + 900 + input 9 900 input 9999 {
      output = 90909;
    } output = 90909 output 90909 System.out.println(output) System.out.println System.out System System.out output String[] args args
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int input = sc.nextInt();
    int output;
    if(input < 10){
      output = input;
    }else if(input < 100){
      output = 9;
    }else if(input < 1000){
      output = 9 + input - 99;
    }else if(input < 10000){
      output = 9 + 900;
    }else if(input < 100000){
      output = 9 + 900 + input - 9999;
    }else{
      output = 90909;
    }
    System.out.println(output);
  }
}