

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int digitNum = (int)Math.log10(N) + 1;

        int ans = 0;
        if(digitNum == 6){
            ans = 9 + 900 + 90000;
        }else if(digitNum == 5){
            ans = 9 + 900 + N - 10000 + 1;
        }else if(digitNum == 4){
            ans = 9 + 900;
        }else if(digitNum == 3){
            ans = 9 + N - 100 + 1;
        }else if(digitNum == 2){
            ans = 9;
        }else if(digitNum == 1){
            ans = N;
        }
        System.out.println("" + ans);
    }

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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int digitNum = (int)Math.log10(N) + 1;

        int ans = 0;
        if(digitNum == 6){
            ans = 9 + 900 + 90000;
        }else if(digitNum == 5){
            ans = 9 + 900 + N - 10000 + 1;
        }else if(digitNum == 4){
            ans = 9 + 900;
        }else if(digitNum == 3){
            ans = 9 + N - 100 + 1;
        }else if(digitNum == 2){
            ans = 9;
        }else if(digitNum == 1){
            ans = N;
        }
        System.out.println("" + ans);
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int digitNum = (int)Math.log10(N) + 1;

        int ans = 0;
        if(digitNum == 6){
            ans = 9 + 900 + 90000;
        }else if(digitNum == 5){
            ans = 9 + 900 + N - 10000 + 1;
        }else if(digitNum == 4){
            ans = 9 + 900;
        }else if(digitNum == 3){
            ans = 9 + N - 100 + 1;
        }else if(digitNum == 2){
            ans = 9;
        }else if(digitNum == 1){
            ans = N;
        }
        System.out.println("" + ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int digitNum = (int)Math.log10(N) + 1;

        int ans = 0;
        if(digitNum == 6){
            ans = 9 + 900 + 90000;
        }else if(digitNum == 5){
            ans = 9 + 900 + N - 10000 + 1;
        }else if(digitNum == 4){
            ans = 9 + 900;
        }else if(digitNum == 3){
            ans = 9 + N - 100 + 1;
        }else if(digitNum == 2){
            ans = 9;
        }else if(digitNum == 1){
            ans = N;
        }
        System.out.println("" + ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int digitNum = (int)Math.log10(N) + 1; digitNum (int)Math.log10(N) + 1 (int)Math.log10(N) Math.log10 Math N 1 int ans = 0; ans 0 if(digitNum == 6){
            ans = 9 + 900 + 90000;
        }else if(digitNum == 5){
            ans = 9 + 900 + N - 10000 + 1;
        }else if(digitNum == 4){
            ans = 9 + 900;
        }else if(digitNum == 3){
            ans = 9 + N - 100 + 1;
        }else if(digitNum == 2){
            ans = 9;
        }else if(digitNum == 1){
            ans = N;
        } digitNum == 6 digitNum 6 {
            ans = 9 + 900 + 90000;
        } ans = 9 + 900 + 90000 ans 9 + 900 + 90000 9 + 900 + 90000 9 900 90000 if(digitNum == 5){
            ans = 9 + 900 + N - 10000 + 1;
        }else if(digitNum == 4){
            ans = 9 + 900;
        }else if(digitNum == 3){
            ans = 9 + N - 100 + 1;
        }else if(digitNum == 2){
            ans = 9;
        }else if(digitNum == 1){
            ans = N;
        } digitNum == 5 digitNum 5 {
            ans = 9 + 900 + N - 10000 + 1;
        } ans = 9 + 900 + N - 10000 + 1 ans 9 + 900 + N - 10000 + 1 9 + 900 + N - 10000 9 + 900 + N 9 + 900 + N 9 900 N 10000 1 if(digitNum == 4){
            ans = 9 + 900;
        }else if(digitNum == 3){
            ans = 9 + N - 100 + 1;
        }else if(digitNum == 2){
            ans = 9;
        }else if(digitNum == 1){
            ans = N;
        } digitNum == 4 digitNum 4 {
            ans = 9 + 900;
        } ans = 9 + 900 ans 9 + 900 9 900 if(digitNum == 3){
            ans = 9 + N - 100 + 1;
        }else if(digitNum == 2){
            ans = 9;
        }else if(digitNum == 1){
            ans = N;
        } digitNum == 3 digitNum 3 {
            ans = 9 + N - 100 + 1;
        } ans = 9 + N - 100 + 1 ans 9 + N - 100 + 1 9 + N - 100 9 + N 9 N 100 1 if(digitNum == 2){
            ans = 9;
        }else if(digitNum == 1){
            ans = N;
        } digitNum == 2 digitNum 2 {
            ans = 9;
        } ans = 9 ans 9 if(digitNum == 1){
            ans = N;
        } digitNum == 1 digitNum 1 {
            ans = N;
        } ans = N ans N System.out.println("" + ans) System.out.println System.out System System.out "" + ans "" ans String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int digitNum = (int)Math.log10(N) + 1;

        int ans = 0;
        if(digitNum == 6){
            ans = 9 + 900 + 90000;
        }else if(digitNum == 5){
            ans = 9 + 900 + N - 10000 + 1;
        }else if(digitNum == 4){
            ans = 9 + 900;
        }else if(digitNum == 3){
            ans = 9 + N - 100 + 1;
        }else if(digitNum == 2){
            ans = 9;
        }else if(digitNum == 1){
            ans = N;
        }
        System.out.println("" + ans);
    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int digitNum = (int)Math.log10(N) + 1;

        int ans = 0;
        if(digitNum == 6){
            ans = 9 + 900 + 90000;
        }else if(digitNum == 5){
            ans = 9 + 900 + N - 10000 + 1;
        }else if(digitNum == 4){
            ans = 9 + 900;
        }else if(digitNum == 3){
            ans = 9 + N - 100 + 1;
        }else if(digitNum == 2){
            ans = 9;
        }else if(digitNum == 1){
            ans = N;
        }
        System.out.println("" + ans);
    }

} Main


import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int digitNum = (int)Math.log10(N) + 1;

        int ans = 0;
        if(digitNum == 6){
            ans = 9 + 900 + 90000;
        }else if(digitNum == 5){
            ans = 9 + 900 + N - 10000 + 1;
        }else if(digitNum == 4){
            ans = 9 + 900;
        }else if(digitNum == 3){
            ans = 9 + N - 100 + 1;
        }else if(digitNum == 2){
            ans = 9;
        }else if(digitNum == 1){
            ans = N;
        }
        System.out.println("" + ans);
    }

}
