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.print(N);
        }else if(N>=10 && N<100){
        System.out.print("9");
        }else if(100<=N && N<1000){
        System.out.print(9+(N-99));
        }else if(1000<=N && N<10000){
        System.out.print("909");        
        }else if(10000<=N && N<100000){
        System.out.print(909+(N-9999));
        }else{
         System.out.print("90909");    
        }
}
} 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.print(N);
        }else if(N>=10 && N<100){
        System.out.print("9");
        }else if(100<=N && N<1000){
        System.out.print(9+(N-99));
        }else if(1000<=N && N<10000){
        System.out.print("909");        
        }else if(10000<=N && N<100000){
        System.out.print(909+(N-9999));
        }else{
         System.out.print("90909");    
        }
}
} Main public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

        if(N<10){
        System.out.print(N);
        }else if(N>=10 && N<100){
        System.out.print("9");
        }else if(100<=N && N<1000){
        System.out.print(9+(N-99));
        }else if(1000<=N && N<10000){
        System.out.print("909");        
        }else if(10000<=N && N<100000){
        System.out.print(909+(N-9999));
        }else{
         System.out.print("90909");    
        }
} main {
    
    Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

        if(N<10){
        System.out.print(N);
        }else if(N>=10 && N<100){
        System.out.print("9");
        }else if(100<=N && N<1000){
        System.out.print(9+(N-99));
        }else if(1000<=N && N<10000){
        System.out.print("909");        
        }else if(10000<=N && N<100000){
        System.out.print(909+(N-9999));
        }else{
         System.out.print("90909");    
        }
} 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.print(N);
        }else if(N>=10 && N<100){
        System.out.print("9");
        }else if(100<=N && N<1000){
        System.out.print(9+(N-99));
        }else if(1000<=N && N<10000){
        System.out.print("909");        
        }else if(10000<=N && N<100000){
        System.out.print(909+(N-9999));
        }else{
         System.out.print("90909");    
        } N<10 N 10 {
        System.out.print(N);
        } System.out.print(N) System.out.print System.out System System.out N if(N>=10 && N<100){
        System.out.print("9");
        }else if(100<=N && N<1000){
        System.out.print(9+(N-99));
        }else if(1000<=N && N<10000){
        System.out.print("909");        
        }else if(10000<=N && N<100000){
        System.out.print(909+(N-9999));
        }else{
         System.out.print("90909");    
        } N>=10 && N<100 N>=10 N 10 N<100 N 100 {
        System.out.print("9");
        } System.out.print("9") System.out.print System.out System System.out "9" if(100<=N && N<1000){
        System.out.print(9+(N-99));
        }else if(1000<=N && N<10000){
        System.out.print("909");        
        }else if(10000<=N && N<100000){
        System.out.print(909+(N-9999));
        }else{
         System.out.print("90909");    
        } 100<=N && N<1000 100<=N 100 N N<1000 N 1000 {
        System.out.print(9+(N-99));
        } System.out.print(9+(N-99)) System.out.print System.out System System.out 9+(N-99) 9 (N-99) N 99 if(1000<=N && N<10000){
        System.out.print("909");        
        }else if(10000<=N && N<100000){
        System.out.print(909+(N-9999));
        }else{
         System.out.print("90909");    
        } 1000<=N && N<10000 1000<=N 1000 N N<10000 N 10000 {
        System.out.print("909");        
        } System.out.print("909") System.out.print System.out System System.out "909" if(10000<=N && N<100000){
        System.out.print(909+(N-9999));
        }else{
         System.out.print("90909");    
        } 10000<=N && N<100000 10000<=N 10000 N N<100000 N 100000 {
        System.out.print(909+(N-9999));
        } System.out.print(909+(N-9999)) System.out.print System.out System System.out 909+(N-9999) 909 (N-9999) N 9999 {
         System.out.print("90909");    
        } System.out.print("90909") System.out.print System.out System System.out "90909" 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.print(N);
        }else if(N>=10 && N<100){
        System.out.print("9");
        }else if(100<=N && N<1000){
        System.out.print(9+(N-99));
        }else if(1000<=N && N<10000){
        System.out.print("909");        
        }else if(10000<=N && N<100000){
        System.out.print(909+(N-9999));
        }else{
         System.out.print("90909");    
        }
}
} public class Main {
	public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

        if(N<10){
        System.out.print(N);
        }else if(N>=10 && N<100){
        System.out.print("9");
        }else if(100<=N && N<1000){
        System.out.print(9+(N-99));
        }else if(1000<=N && N<10000){
        System.out.print("909");        
        }else if(10000<=N && N<100000){
        System.out.print(909+(N-9999));
        }else{
         System.out.print("90909");    
        }
}
} 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.print(N);
        }else if(N>=10 && N<100){
        System.out.print("9");
        }else if(100<=N && N<1000){
        System.out.print(9+(N-99));
        }else if(1000<=N && N<10000){
        System.out.print("909");        
        }else if(10000<=N && N<100000){
        System.out.print(909+(N-9999));
        }else{
         System.out.print("90909");    
        }
}
}
