import java.util.Scanner;

public class Main {
    public static boolean debug = true;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        if(a <10){
            System.out.println(a);
        }else if(a<100){
            System.out.println(9);
        }else if(a<1000){
            System.out.println(9 + a-100+1);
        }else if(a<10000){
            System.out.println(9 + 900);
        }else if(a<100000){
            System.out.println(909 + a-10000+1);
        }else if(a==100000){
            System.out.println(9 + 900 + 90000);
        }



    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static boolean debug = true;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        if(a <10){
            System.out.println(a);
        }else if(a<100){
            System.out.println(9);
        }else if(a<1000){
            System.out.println(9 + a-100+1);
        }else if(a<10000){
            System.out.println(9 + 900);
        }else if(a<100000){
            System.out.println(909 + a-10000+1);
        }else if(a==100000){
            System.out.println(9 + 900 + 90000);
        }



    }
} Main public static boolean debug = true; debug true public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        if(a <10){
            System.out.println(a);
        }else if(a<100){
            System.out.println(9);
        }else if(a<1000){
            System.out.println(9 + a-100+1);
        }else if(a<10000){
            System.out.println(9 + 900);
        }else if(a<100000){
            System.out.println(909 + a-10000+1);
        }else if(a==100000){
            System.out.println(9 + 900 + 90000);
        }



    } main {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        if(a <10){
            System.out.println(a);
        }else if(a<100){
            System.out.println(9);
        }else if(a<1000){
            System.out.println(9 + a-100+1);
        }else if(a<10000){
            System.out.println(9 + 900);
        }else if(a<100000){
            System.out.println(909 + a-10000+1);
        }else if(a==100000){
            System.out.println(9 + 900 + 90000);
        }



    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc if(a <10){
            System.out.println(a);
        }else if(a<100){
            System.out.println(9);
        }else if(a<1000){
            System.out.println(9 + a-100+1);
        }else if(a<10000){
            System.out.println(9 + 900);
        }else if(a<100000){
            System.out.println(909 + a-10000+1);
        }else if(a==100000){
            System.out.println(9 + 900 + 90000);
        } a <10 a 10 {
            System.out.println(a);
        } System.out.println(a) System.out.println System.out System System.out a if(a<100){
            System.out.println(9);
        }else if(a<1000){
            System.out.println(9 + a-100+1);
        }else if(a<10000){
            System.out.println(9 + 900);
        }else if(a<100000){
            System.out.println(909 + a-10000+1);
        }else if(a==100000){
            System.out.println(9 + 900 + 90000);
        } a<100 a 100 {
            System.out.println(9);
        } System.out.println(9) System.out.println System.out System System.out 9 if(a<1000){
            System.out.println(9 + a-100+1);
        }else if(a<10000){
            System.out.println(9 + 900);
        }else if(a<100000){
            System.out.println(909 + a-10000+1);
        }else if(a==100000){
            System.out.println(9 + 900 + 90000);
        } a<1000 a 1000 {
            System.out.println(9 + a-100+1);
        } System.out.println(9 + a-100+1) System.out.println System.out System System.out 9 + a-100+1 9 + a-100 9 + a 9 a 100 1 if(a<10000){
            System.out.println(9 + 900);
        }else if(a<100000){
            System.out.println(909 + a-10000+1);
        }else if(a==100000){
            System.out.println(9 + 900 + 90000);
        } a<10000 a 10000 {
            System.out.println(9 + 900);
        } System.out.println(9 + 900) System.out.println System.out System System.out 9 + 900 9 900 if(a<100000){
            System.out.println(909 + a-10000+1);
        }else if(a==100000){
            System.out.println(9 + 900 + 90000);
        } a<100000 a 100000 {
            System.out.println(909 + a-10000+1);
        } System.out.println(909 + a-10000+1) System.out.println System.out System System.out 909 + a-10000+1 909 + a-10000 909 + a 909 a 10000 1 if(a==100000){
            System.out.println(9 + 900 + 90000);
        } a==100000 a 100000 {
            System.out.println(9 + 900 + 90000);
        } System.out.println(9 + 900 + 90000) System.out.println System.out System System.out 9 + 900 + 90000 9 + 900 + 90000 9 900 90000 String[] args args public class Main {
    public static boolean debug = true;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        if(a <10){
            System.out.println(a);
        }else if(a<100){
            System.out.println(9);
        }else if(a<1000){
            System.out.println(9 + a-100+1);
        }else if(a<10000){
            System.out.println(9 + 900);
        }else if(a<100000){
            System.out.println(909 + a-10000+1);
        }else if(a==100000){
            System.out.println(9 + 900 + 90000);
        }



    }
} public class Main {
    public static boolean debug = true;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        if(a <10){
            System.out.println(a);
        }else if(a<100){
            System.out.println(9);
        }else if(a<1000){
            System.out.println(9 + a-100+1);
        }else if(a<10000){
            System.out.println(9 + 900);
        }else if(a<100000){
            System.out.println(909 + a-10000+1);
        }else if(a==100000){
            System.out.println(9 + 900 + 90000);
        }



    }
} Main
import java.util.Scanner;

public class Main {
    public static boolean debug = true;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        if(a <10){
            System.out.println(a);
        }else if(a<100){
            System.out.println(9);
        }else if(a<1000){
            System.out.println(9 + a-100+1);
        }else if(a<10000){
            System.out.println(9 + 900);
        }else if(a<100000){
            System.out.println(909 + a-10000+1);
        }else if(a==100000){
            System.out.println(9 + 900 + 90000);
        }



    }
}