import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    
    int count = 0;
    
    if (0 < n && n < 10) {
      count = n;
    } else if (n < 100) {
      count = 9;
    } else if (n < 1000) {
      count = 9 + n - 99;
    } else if (n < 10000) {
      count = 909;
    } else if (n < 100000) {
      count = 9 + 900 + n - 9999;
    } else if (n < 1000000) {
      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 n = sc.nextInt();
    
    int count = 0;
    
    if (0 < n && n < 10) {
      count = n;
    } else if (n < 100) {
      count = 9;
    } else if (n < 1000) {
      count = 9 + n - 99;
    } else if (n < 10000) {
      count = 909;
    } else if (n < 100000) {
      count = 9 + 900 + n - 9999;
    } else if (n < 1000000) {
      count = 90909;
    }
    System.out.println(count);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    
    int count = 0;
    
    if (0 < n && n < 10) {
      count = n;
    } else if (n < 100) {
      count = 9;
    } else if (n < 1000) {
      count = 9 + n - 99;
    } else if (n < 10000) {
      count = 909;
    } else if (n < 100000) {
      count = 9 + 900 + n - 9999;
    } else if (n < 1000000) {
      count = 90909;
    }
    System.out.println(count);
  } main {
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    
    int count = 0;
    
    if (0 < n && n < 10) {
      count = n;
    } else if (n < 100) {
      count = 9;
    } else if (n < 1000) {
      count = 9 + n - 99;
    } else if (n < 10000) {
      count = 909;
    } else if (n < 100000) {
      count = 9 + 900 + n - 9999;
    } else if (n < 1000000) {
      count = 90909;
    }
    System.out.println(count);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int count = 0; count 0 if (0 < n && n < 10) {
      count = n;
    } else if (n < 100) {
      count = 9;
    } else if (n < 1000) {
      count = 9 + n - 99;
    } else if (n < 10000) {
      count = 909;
    } else if (n < 100000) {
      count = 9 + 900 + n - 9999;
    } else if (n < 1000000) {
      count = 90909;
    } 0 < n && n < 10 0 < n 0 n n < 10 n 10 {
      count = n;
    } count = n count n if (n < 100) {
      count = 9;
    } else if (n < 1000) {
      count = 9 + n - 99;
    } else if (n < 10000) {
      count = 909;
    } else if (n < 100000) {
      count = 9 + 900 + n - 9999;
    } else if (n < 1000000) {
      count = 90909;
    } n < 100 n 100 {
      count = 9;
    } count = 9 count 9 if (n < 1000) {
      count = 9 + n - 99;
    } else if (n < 10000) {
      count = 909;
    } else if (n < 100000) {
      count = 9 + 900 + n - 9999;
    } else if (n < 1000000) {
      count = 90909;
    } n < 1000 n 1000 {
      count = 9 + n - 99;
    } count = 9 + n - 99 count 9 + n - 99 9 + n 9 n 99 if (n < 10000) {
      count = 909;
    } else if (n < 100000) {
      count = 9 + 900 + n - 9999;
    } else if (n < 1000000) {
      count = 90909;
    } n < 10000 n 10000 {
      count = 909;
    } count = 909 count 909 if (n < 100000) {
      count = 9 + 900 + n - 9999;
    } else if (n < 1000000) {
      count = 90909;
    } n < 100000 n 100000 {
      count = 9 + 900 + n - 9999;
    } count = 9 + 900 + n - 9999 count 9 + 900 + n - 9999 9 + 900 + n 9 + 900 + n 9 900 n 9999 if (n < 1000000) {
      count = 90909;
    } n < 1000000 n 1000000 {
      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 n = sc.nextInt();
    
    int count = 0;
    
    if (0 < n && n < 10) {
      count = n;
    } else if (n < 100) {
      count = 9;
    } else if (n < 1000) {
      count = 9 + n - 99;
    } else if (n < 10000) {
      count = 909;
    } else if (n < 100000) {
      count = 9 + 900 + n - 9999;
    } else if (n < 1000000) {
      count = 90909;
    }
    System.out.println(count);
  }
} public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    
    int count = 0;
    
    if (0 < n && n < 10) {
      count = n;
    } else if (n < 100) {
      count = 9;
    } else if (n < 1000) {
      count = 9 + n - 99;
    } else if (n < 10000) {
      count = 909;
    } else if (n < 100000) {
      count = 9 + 900 + n - 9999;
    } else if (n < 1000000) {
      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 n = sc.nextInt();
    
    int count = 0;
    
    if (0 < n && n < 10) {
      count = n;
    } else if (n < 100) {
      count = 9;
    } else if (n < 1000) {
      count = 9 + n - 99;
    } else if (n < 10000) {
      count = 909;
    } else if (n < 100000) {
      count = 9 + 900 + n - 9999;
    } else if (n < 1000000) {
      count = 90909;
    }
    System.out.println(count);
  }
}