import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        //String s = sc.next();
        
        if(n < 10){
            System.out.println(n);
        }else if(n<100){
            System.out.println(9);
        }else if(n<1000){
            System.out.println(n-90);
        }else if(n<10000){
            System.out.println(909);
        }else if(n<100000){
            System.out.println(n-9090);
        }else{
            System.out.println(90909);
        }
        
        //System.out.println(max);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        //String s = sc.next();
        
        if(n < 10){
            System.out.println(n);
        }else if(n<100){
            System.out.println(9);
        }else if(n<1000){
            System.out.println(n-90);
        }else if(n<10000){
            System.out.println(909);
        }else if(n<100000){
            System.out.println(n-9090);
        }else{
            System.out.println(90909);
        }
        
        //System.out.println(max);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        //String s = sc.next();
        
        if(n < 10){
            System.out.println(n);
        }else if(n<100){
            System.out.println(9);
        }else if(n<1000){
            System.out.println(n-90);
        }else if(n<10000){
            System.out.println(909);
        }else if(n<100000){
            System.out.println(n-9090);
        }else{
            System.out.println(90909);
        }
        
        //System.out.println(max);
    } main {
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        //String s = sc.next();
        
        if(n < 10){
            System.out.println(n);
        }else if(n<100){
            System.out.println(9);
        }else if(n<1000){
            System.out.println(n-90);
        }else if(n<10000){
            System.out.println(909);
        }else if(n<100000){
            System.out.println(n-9090);
        }else{
            System.out.println(90909);
        }
        
        //System.out.println(max);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if(n < 10){
            System.out.println(n);
        }else if(n<100){
            System.out.println(9);
        }else if(n<1000){
            System.out.println(n-90);
        }else if(n<10000){
            System.out.println(909);
        }else if(n<100000){
            System.out.println(n-9090);
        }else{
            System.out.println(90909);
        } n < 10 n 10 {
            System.out.println(n);
        } System.out.println(n) System.out.println System.out System System.out n if(n<100){
            System.out.println(9);
        }else if(n<1000){
            System.out.println(n-90);
        }else if(n<10000){
            System.out.println(909);
        }else if(n<100000){
            System.out.println(n-9090);
        }else{
            System.out.println(90909);
        } n<100 n 100 {
            System.out.println(9);
        } System.out.println(9) System.out.println System.out System System.out 9 if(n<1000){
            System.out.println(n-90);
        }else if(n<10000){
            System.out.println(909);
        }else if(n<100000){
            System.out.println(n-9090);
        }else{
            System.out.println(90909);
        } n<1000 n 1000 {
            System.out.println(n-90);
        } System.out.println(n-90) System.out.println System.out System System.out n-90 n 90 if(n<10000){
            System.out.println(909);
        }else if(n<100000){
            System.out.println(n-9090);
        }else{
            System.out.println(90909);
        } n<10000 n 10000 {
            System.out.println(909);
        } System.out.println(909) System.out.println System.out System System.out 909 if(n<100000){
            System.out.println(n-9090);
        }else{
            System.out.println(90909);
        } n<100000 n 100000 {
            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) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        //String s = sc.next();
        
        if(n < 10){
            System.out.println(n);
        }else if(n<100){
            System.out.println(9);
        }else if(n<1000){
            System.out.println(n-90);
        }else if(n<10000){
            System.out.println(909);
        }else if(n<100000){
            System.out.println(n-9090);
        }else{
            System.out.println(90909);
        }
        
        //System.out.println(max);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        //String s = sc.next();
        
        if(n < 10){
            System.out.println(n);
        }else if(n<100){
            System.out.println(9);
        }else if(n<1000){
            System.out.println(n-90);
        }else if(n<10000){
            System.out.println(909);
        }else if(n<100000){
            System.out.println(n-9090);
        }else{
            System.out.println(90909);
        }
        
        //System.out.println(max);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        //String s = sc.next();
        
        if(n < 10){
            System.out.println(n);
        }else if(n<100){
            System.out.println(9);
        }else if(n<1000){
            System.out.println(n-90);
        }else if(n<10000){
            System.out.println(909);
        }else if(n<100000){
            System.out.println(n-9090);
        }else{
            System.out.println(90909);
        }
        
        //System.out.println(max);
    }
}