import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int number, count;
    number = Integer.parseInt(sc.next());
    if(number < 9) {
      count = number;
    } else if(number < 100) {
      count = 9;
    } else if(number < 999) {
      count = 9 + (number - 99);
    } else if(number < 10000) {
      count = 909;
    } else if(number < 99999) {
      count = 9 + 900 + (number - 9999);
    } else {
      count = 90909;
    }
    System.out.println(count);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int number, count;
    number = Integer.parseInt(sc.next());
    if(number < 9) {
      count = number;
    } else if(number < 100) {
      count = 9;
    } else if(number < 999) {
      count = 9 + (number - 99);
    } else if(number < 10000) {
      count = 909;
    } else if(number < 99999) {
      count = 9 + 900 + (number - 9999);
    } else {
      count = 90909;
    }
    System.out.println(count);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int number, count;
    number = Integer.parseInt(sc.next());
    if(number < 9) {
      count = number;
    } else if(number < 100) {
      count = 9;
    } else if(number < 999) {
      count = 9 + (number - 99);
    } else if(number < 10000) {
      count = 909;
    } else if(number < 99999) {
      count = 9 + 900 + (number - 9999);
    } else {
      count = 90909;
    }
    System.out.println(count);
  } main {
    Scanner sc = new Scanner(System.in);
    int number, count;
    number = Integer.parseInt(sc.next());
    if(number < 9) {
      count = number;
    } else if(number < 100) {
      count = 9;
    } else if(number < 999) {
      count = 9 + (number - 99);
    } else if(number < 10000) {
      count = 909;
    } else if(number < 99999) {
      count = 9 + 900 + (number - 9999);
    } else {
      count = 90909;
    }
    System.out.println(count);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int number number count; count number = Integer.parseInt(sc.next()) number Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if(number < 9) {
      count = number;
    } else if(number < 100) {
      count = 9;
    } else if(number < 999) {
      count = 9 + (number - 99);
    } else if(number < 10000) {
      count = 909;
    } else if(number < 99999) {
      count = 9 + 900 + (number - 9999);
    } else {
      count = 90909;
    } number < 9 number 9 {
      count = number;
    } count = number count number if(number < 100) {
      count = 9;
    } else if(number < 999) {
      count = 9 + (number - 99);
    } else if(number < 10000) {
      count = 909;
    } else if(number < 99999) {
      count = 9 + 900 + (number - 9999);
    } else {
      count = 90909;
    } number < 100 number 100 {
      count = 9;
    } count = 9 count 9 if(number < 999) {
      count = 9 + (number - 99);
    } else if(number < 10000) {
      count = 909;
    } else if(number < 99999) {
      count = 9 + 900 + (number - 9999);
    } else {
      count = 90909;
    } number < 999 number 999 {
      count = 9 + (number - 99);
    } count = 9 + (number - 99) count 9 + (number - 99) 9 (number - 99) number 99 if(number < 10000) {
      count = 909;
    } else if(number < 99999) {
      count = 9 + 900 + (number - 9999);
    } else {
      count = 90909;
    } number < 10000 number 10000 {
      count = 909;
    } count = 909 count 909 if(number < 99999) {
      count = 9 + 900 + (number - 9999);
    } else {
      count = 90909;
    } number < 99999 number 99999 {
      count = 9 + 900 + (number - 9999);
    } count = 9 + 900 + (number - 9999) count 9 + 900 + (number - 9999) 9 + 900 + (number - 9999) 9 900 (number - 9999) number 9999 {
      count = 90909;
    } count = 90909 count 90909 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int number, count;
    number = Integer.parseInt(sc.next());
    if(number < 9) {
      count = number;
    } else if(number < 100) {
      count = 9;
    } else if(number < 999) {
      count = 9 + (number - 99);
    } else if(number < 10000) {
      count = 909;
    } else if(number < 99999) {
      count = 9 + 900 + (number - 9999);
    } else {
      count = 90909;
    }
    System.out.println(count);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int number, count;
    number = Integer.parseInt(sc.next());
    if(number < 9) {
      count = number;
    } else if(number < 100) {
      count = 9;
    } else if(number < 999) {
      count = 9 + (number - 99);
    } else if(number < 10000) {
      count = 909;
    } else if(number < 99999) {
      count = 9 + 900 + (number - 9999);
    } else {
      count = 90909;
    }
    System.out.println(count);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int number, count;
    number = Integer.parseInt(sc.next());
    if(number < 9) {
      count = number;
    } else if(number < 100) {
      count = 9;
    } else if(number < 999) {
      count = 9 + (number - 99);
    } else if(number < 10000) {
      count = 909;
    } else if(number < 99999) {
      count = 9 + 900 + (number - 9999);
    } else {
      count = 90909;
    }
    System.out.println(count);
  }
}
