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