import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int n = scan.nextInt();
        int out = 0;
        if(n < 100){
            if(n > 9){
                out = 9;
            }else{
                out = n;
            }
        }else if(n < 10000){
            if(n < 1000){
                out = n - 90;
            }else{
                out = 909;
            }
        }else if(n < 100000){
            out = n - 9090;
        }else{
            out = 90909;
        }
        System.out.println(out);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int n = scan.nextInt();
        int out = 0;
        if(n < 100){
            if(n > 9){
                out = 9;
            }else{
                out = n;
            }
        }else if(n < 10000){
            if(n < 1000){
                out = n - 90;
            }else{
                out = 909;
            }
        }else if(n < 100000){
            out = n - 9090;
        }else{
            out = 90909;
        }
        System.out.println(out);
    }
} Main public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int n = scan.nextInt();
        int out = 0;
        if(n < 100){
            if(n > 9){
                out = 9;
            }else{
                out = n;
            }
        }else if(n < 10000){
            if(n < 1000){
                out = n - 90;
            }else{
                out = 909;
            }
        }else if(n < 100000){
            out = n - 9090;
        }else{
            out = 90909;
        }
        System.out.println(out);
    } main {
        Scanner scan = new java.util.Scanner(System.in);
        int n = scan.nextInt();
        int out = 0;
        if(n < 100){
            if(n > 9){
                out = 9;
            }else{
                out = n;
            }
        }else if(n < 10000){
            if(n < 1000){
                out = n - 90;
            }else{
                out = 909;
            }
        }else if(n < 100000){
            out = n - 9090;
        }else{
            out = 90909;
        }
        System.out.println(out);
    } Scanner scan = new java.util.Scanner(System.in); scan new java.util.Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int out = 0; out 0 if(n < 100){
            if(n > 9){
                out = 9;
            }else{
                out = n;
            }
        }else if(n < 10000){
            if(n < 1000){
                out = n - 90;
            }else{
                out = 909;
            }
        }else if(n < 100000){
            out = n - 9090;
        }else{
            out = 90909;
        } n < 100 n 100 {
            if(n > 9){
                out = 9;
            }else{
                out = n;
            }
        } if(n > 9){
                out = 9;
            }else{
                out = n;
            } n > 9 n 9 {
                out = 9;
            } out = 9 out 9 {
                out = n;
            } out = n out n if(n < 10000){
            if(n < 1000){
                out = n - 90;
            }else{
                out = 909;
            }
        }else if(n < 100000){
            out = n - 9090;
        }else{
            out = 90909;
        } n < 10000 n 10000 {
            if(n < 1000){
                out = n - 90;
            }else{
                out = 909;
            }
        } if(n < 1000){
                out = n - 90;
            }else{
                out = 909;
            } n < 1000 n 1000 {
                out = n - 90;
            } out = n - 90 out n - 90 n 90 {
                out = 909;
            } out = 909 out 909 if(n < 100000){
            out = n - 9090;
        }else{
            out = 90909;
        } n < 100000 n 100000 {
            out = n - 9090;
        } out = n - 9090 out n - 9090 n 9090 {
            out = 90909;
        } out = 90909 out 90909 System.out.println(out) System.out.println System.out System System.out out String[] args args public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int n = scan.nextInt();
        int out = 0;
        if(n < 100){
            if(n > 9){
                out = 9;
            }else{
                out = n;
            }
        }else if(n < 10000){
            if(n < 1000){
                out = n - 90;
            }else{
                out = 909;
            }
        }else if(n < 100000){
            out = n - 9090;
        }else{
            out = 90909;
        }
        System.out.println(out);
    }
} public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int n = scan.nextInt();
        int out = 0;
        if(n < 100){
            if(n > 9){
                out = 9;
            }else{
                out = n;
            }
        }else if(n < 10000){
            if(n < 1000){
                out = n - 90;
            }else{
                out = 909;
            }
        }else if(n < 100000){
            out = n - 9090;
        }else{
            out = 90909;
        }
        System.out.println(out);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int n = scan.nextInt();
        int out = 0;
        if(n < 100){
            if(n > 9){
                out = 9;
            }else{
                out = n;
            }
        }else if(n < 10000){
            if(n < 1000){
                out = n - 90;
            }else{
                out = 909;
            }
        }else if(n < 100000){
            out = n - 9090;
        }else{
            out = 90909;
        }
        System.out.println(out);
    }
}