import java.util.Scanner;

public class Main {

	
	public static void main(String[] args) {
		
		
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        	
				
		if(n<=9) {
			System.out.println(n);
		}else if(n<=99){
			System.out.println(9);
		}else if(n<=999) {
			System.out.println(n-90);
	    }else if(n<=9999) {
	    	System.out.println(909);
	    }else if(n<=99999) {
	    	System.out.println(n-9090);
	    }else{
	    	System.out.println(90909);
	    }
		
	}

} import java.util.Scanner; Scanner java.util public class Main {

	
	public static void main(String[] args) {
		
		
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        	
				
		if(n<=9) {
			System.out.println(n);
		}else if(n<=99){
			System.out.println(9);
		}else if(n<=999) {
			System.out.println(n-90);
	    }else if(n<=9999) {
	    	System.out.println(909);
	    }else if(n<=99999) {
	    	System.out.println(n-9090);
	    }else{
	    	System.out.println(90909);
	    }
		
	}

} Main public static void main(String[] args) {
		
		
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        	
				
		if(n<=9) {
			System.out.println(n);
		}else if(n<=99){
			System.out.println(9);
		}else if(n<=999) {
			System.out.println(n-90);
	    }else if(n<=9999) {
	    	System.out.println(909);
	    }else if(n<=99999) {
	    	System.out.println(n-9090);
	    }else{
	    	System.out.println(90909);
	    }
		
	} main {
		
		
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        	
				
		if(n<=9) {
			System.out.println(n);
		}else if(n<=99){
			System.out.println(9);
		}else if(n<=999) {
			System.out.println(n-90);
	    }else if(n<=9999) {
	    	System.out.println(909);
	    }else if(n<=99999) {
	    	System.out.println(n-9090);
	    }else{
	    	System.out.println(90909);
	    }
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc if(n<=9) {
			System.out.println(n);
		}else if(n<=99){
			System.out.println(9);
		}else if(n<=999) {
			System.out.println(n-90);
	    }else if(n<=9999) {
	    	System.out.println(909);
	    }else if(n<=99999) {
	    	System.out.println(n-9090);
	    }else{
	    	System.out.println(90909);
	    } n<=9 n 9 {
			System.out.println(n);
		} System.out.println(n) System.out.println System.out System System.out n if(n<=99){
			System.out.println(9);
		}else if(n<=999) {
			System.out.println(n-90);
	    }else if(n<=9999) {
	    	System.out.println(909);
	    }else if(n<=99999) {
	    	System.out.println(n-9090);
	    }else{
	    	System.out.println(90909);
	    } n<=99 n 99 {
			System.out.println(9);
		} System.out.println(9) System.out.println System.out System System.out 9 if(n<=999) {
			System.out.println(n-90);
	    }else if(n<=9999) {
	    	System.out.println(909);
	    }else if(n<=99999) {
	    	System.out.println(n-9090);
	    }else{
	    	System.out.println(90909);
	    } n<=999 n 999 {
			System.out.println(n-90);
	    } System.out.println(n-90) System.out.println System.out System System.out n-90 n 90 if(n<=9999) {
	    	System.out.println(909);
	    }else if(n<=99999) {
	    	System.out.println(n-9090);
	    }else{
	    	System.out.println(90909);
	    } n<=9999 n 9999 {
	    	System.out.println(909);
	    } System.out.println(909) System.out.println System.out System System.out 909 if(n<=99999) {
	    	System.out.println(n-9090);
	    }else{
	    	System.out.println(90909);
	    } n<=99999 n 99999 {
	    	System.out.println(n-9090);
	    } System.out.println(n-9090) System.out.println System.out System System.out n-9090 n 9090 {
	    	System.out.println(90909);
	    } System.out.println(90909) System.out.println 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<=9) {
			System.out.println(n);
		}else if(n<=99){
			System.out.println(9);
		}else if(n<=999) {
			System.out.println(n-90);
	    }else if(n<=9999) {
	    	System.out.println(909);
	    }else if(n<=99999) {
	    	System.out.println(n-9090);
	    }else{
	    	System.out.println(90909);
	    }
		
	}

} public class Main {

	
	public static void main(String[] args) {
		
		
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        	
				
		if(n<=9) {
			System.out.println(n);
		}else if(n<=99){
			System.out.println(9);
		}else if(n<=999) {
			System.out.println(n-90);
	    }else if(n<=9999) {
	    	System.out.println(909);
	    }else if(n<=99999) {
	    	System.out.println(n-9090);
	    }else{
	    	System.out.println(90909);
	    }
		
	}

} Main
import java.util.Scanner;

public class Main {

	
	public static void main(String[] args) {
		
		
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        	
				
		if(n<=9) {
			System.out.println(n);
		}else if(n<=99){
			System.out.println(9);
		}else if(n<=999) {
			System.out.println(n-90);
	    }else if(n<=9999) {
	    	System.out.println(909);
	    }else if(n<=99999) {
	    	System.out.println(n-9090);
	    }else{
	    	System.out.println(90909);
	    }
		
	}

}
