import java.util.Scanner;

public class Main {
    public static int N = 0;
    public static String output = "";

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        int length = String.valueOf( N ).length();
        if (length == 6) {
            output = Integer.toString(9 + 900 + 90000);
        }
        else if (length == 5) {
            output = Integer.toString(9 + 900 + (N - 9999));
        }
        else if (length == 4) {
            output = Integer.toString(9 + 900);
        }
        else if (length == 3) {
            output = Integer.toString(9 + (N - 99));
        }
        else if (length == 2) {
            output = Integer.toString(9);
        }
        else if (length == 1) {
            output = Integer.toString(N);
        }

        System.out.println(output);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static int N = 0;
    public static String output = "";

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        int length = String.valueOf( N ).length();
        if (length == 6) {
            output = Integer.toString(9 + 900 + 90000);
        }
        else if (length == 5) {
            output = Integer.toString(9 + 900 + (N - 9999));
        }
        else if (length == 4) {
            output = Integer.toString(9 + 900);
        }
        else if (length == 3) {
            output = Integer.toString(9 + (N - 99));
        }
        else if (length == 2) {
            output = Integer.toString(9);
        }
        else if (length == 1) {
            output = Integer.toString(N);
        }

        System.out.println(output);
    }
} Main public static int N = 0; N 0 public static String output = ""; output "" public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        int length = String.valueOf( N ).length();
        if (length == 6) {
            output = Integer.toString(9 + 900 + 90000);
        }
        else if (length == 5) {
            output = Integer.toString(9 + 900 + (N - 9999));
        }
        else if (length == 4) {
            output = Integer.toString(9 + 900);
        }
        else if (length == 3) {
            output = Integer.toString(9 + (N - 99));
        }
        else if (length == 2) {
            output = Integer.toString(9);
        }
        else if (length == 1) {
            output = Integer.toString(N);
        }

        System.out.println(output);
    } main {

        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        int length = String.valueOf( N ).length();
        if (length == 6) {
            output = Integer.toString(9 + 900 + 90000);
        }
        else if (length == 5) {
            output = Integer.toString(9 + 900 + (N - 9999));
        }
        else if (length == 4) {
            output = Integer.toString(9 + 900);
        }
        else if (length == 3) {
            output = Integer.toString(9 + (N - 99));
        }
        else if (length == 2) {
            output = Integer.toString(9);
        }
        else if (length == 1) {
            output = Integer.toString(N);
        }

        System.out.println(output);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) N = sc.nextInt() N sc.nextInt() sc.nextInt sc int length = String.valueOf( N ).length(); length String.valueOf( N ).length() String.valueOf( N ).length String.valueOf( N ) String.valueOf String N if (length == 6) {
            output = Integer.toString(9 + 900 + 90000);
        }
        else if (length == 5) {
            output = Integer.toString(9 + 900 + (N - 9999));
        }
        else if (length == 4) {
            output = Integer.toString(9 + 900);
        }
        else if (length == 3) {
            output = Integer.toString(9 + (N - 99));
        }
        else if (length == 2) {
            output = Integer.toString(9);
        }
        else if (length == 1) {
            output = Integer.toString(N);
        } length == 6 length 6 {
            output = Integer.toString(9 + 900 + 90000);
        } output = Integer.toString(9 + 900 + 90000) output Integer.toString(9 + 900 + 90000) Integer.toString Integer 9 + 900 + 90000 9 + 900 + 90000 9 900 90000 if (length == 5) {
            output = Integer.toString(9 + 900 + (N - 9999));
        }
        else if (length == 4) {
            output = Integer.toString(9 + 900);
        }
        else if (length == 3) {
            output = Integer.toString(9 + (N - 99));
        }
        else if (length == 2) {
            output = Integer.toString(9);
        }
        else if (length == 1) {
            output = Integer.toString(N);
        } length == 5 length 5 {
            output = Integer.toString(9 + 900 + (N - 9999));
        } output = Integer.toString(9 + 900 + (N - 9999)) output Integer.toString(9 + 900 + (N - 9999)) Integer.toString Integer 9 + 900 + (N - 9999) 9 + 900 + (N - 9999) 9 900 (N - 9999) N 9999 if (length == 4) {
            output = Integer.toString(9 + 900);
        }
        else if (length == 3) {
            output = Integer.toString(9 + (N - 99));
        }
        else if (length == 2) {
            output = Integer.toString(9);
        }
        else if (length == 1) {
            output = Integer.toString(N);
        } length == 4 length 4 {
            output = Integer.toString(9 + 900);
        } output = Integer.toString(9 + 900) output Integer.toString(9 + 900) Integer.toString Integer 9 + 900 9 900 if (length == 3) {
            output = Integer.toString(9 + (N - 99));
        }
        else if (length == 2) {
            output = Integer.toString(9);
        }
        else if (length == 1) {
            output = Integer.toString(N);
        } length == 3 length 3 {
            output = Integer.toString(9 + (N - 99));
        } output = Integer.toString(9 + (N - 99)) output Integer.toString(9 + (N - 99)) Integer.toString Integer 9 + (N - 99) 9 (N - 99) N 99 if (length == 2) {
            output = Integer.toString(9);
        }
        else if (length == 1) {
            output = Integer.toString(N);
        } length == 2 length 2 {
            output = Integer.toString(9);
        } output = Integer.toString(9) output Integer.toString(9) Integer.toString Integer 9 if (length == 1) {
            output = Integer.toString(N);
        } length == 1 length 1 {
            output = Integer.toString(N);
        } output = Integer.toString(N) output Integer.toString(N) Integer.toString Integer N System.out.println(output) System.out.println System.out System System.out output String[] args args public class Main {
    public static int N = 0;
    public static String output = "";

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        int length = String.valueOf( N ).length();
        if (length == 6) {
            output = Integer.toString(9 + 900 + 90000);
        }
        else if (length == 5) {
            output = Integer.toString(9 + 900 + (N - 9999));
        }
        else if (length == 4) {
            output = Integer.toString(9 + 900);
        }
        else if (length == 3) {
            output = Integer.toString(9 + (N - 99));
        }
        else if (length == 2) {
            output = Integer.toString(9);
        }
        else if (length == 1) {
            output = Integer.toString(N);
        }

        System.out.println(output);
    }
} public class Main {
    public static int N = 0;
    public static String output = "";

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        int length = String.valueOf( N ).length();
        if (length == 6) {
            output = Integer.toString(9 + 900 + 90000);
        }
        else if (length == 5) {
            output = Integer.toString(9 + 900 + (N - 9999));
        }
        else if (length == 4) {
            output = Integer.toString(9 + 900);
        }
        else if (length == 3) {
            output = Integer.toString(9 + (N - 99));
        }
        else if (length == 2) {
            output = Integer.toString(9);
        }
        else if (length == 1) {
            output = Integer.toString(N);
        }

        System.out.println(output);
    }
} Main
import java.util.Scanner;

public class Main {
    public static int N = 0;
    public static String output = "";

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        int length = String.valueOf( N ).length();
        if (length == 6) {
            output = Integer.toString(9 + 900 + 90000);
        }
        else if (length == 5) {
            output = Integer.toString(9 + 900 + (N - 9999));
        }
        else if (length == 4) {
            output = Integer.toString(9 + 900);
        }
        else if (length == 3) {
            output = Integer.toString(9 + (N - 99));
        }
        else if (length == 2) {
            output = Integer.toString(9);
        }
        else if (length == 1) {
            output = Integer.toString(N);
        }

        System.out.println(output);
    }
}