import java.util.Scanner;

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

        if (n < 100) {
            System.out.println(9 - (9 - Math.min(n, 9)));
        } else if (n < 10000) {
            System.out.println(909 - (999 - Math.min(n, 999)));
        } else {
            System.out.println(90909 - (99999 - Math.min(n, 99999)));
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        if (n < 100) {
            System.out.println(9 - (9 - Math.min(n, 9)));
        } else if (n < 10000) {
            System.out.println(909 - (999 - Math.min(n, 999)));
        } else {
            System.out.println(90909 - (99999 - Math.min(n, 99999)));
        }
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        if (n < 100) {
            System.out.println(9 - (9 - Math.min(n, 9)));
        } else if (n < 10000) {
            System.out.println(909 - (999 - Math.min(n, 999)));
        } else {
            System.out.println(90909 - (99999 - Math.min(n, 99999)));
        }
    } main {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        if (n < 100) {
            System.out.println(9 - (9 - Math.min(n, 9)));
        } else if (n < 10000) {
            System.out.println(909 - (999 - Math.min(n, 999)));
        } else {
            System.out.println(90909 - (99999 - Math.min(n, 99999)));
        }
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in if (n < 100) {
            System.out.println(9 - (9 - Math.min(n, 9)));
        } else if (n < 10000) {
            System.out.println(909 - (999 - Math.min(n, 999)));
        } else {
            System.out.println(90909 - (99999 - Math.min(n, 99999)));
        } n < 100 n 100 {
            System.out.println(9 - (9 - Math.min(n, 9)));
        } System.out.println(9 - (9 - Math.min(n, 9))) System.out.println System.out System System.out 9 - (9 - Math.min(n, 9)) 9 (9 - Math.min(n, 9)) 9 Math.min(n, 9) Math.min Math n 9 if (n < 10000) {
            System.out.println(909 - (999 - Math.min(n, 999)));
        } else {
            System.out.println(90909 - (99999 - Math.min(n, 99999)));
        } n < 10000 n 10000 {
            System.out.println(909 - (999 - Math.min(n, 999)));
        } System.out.println(909 - (999 - Math.min(n, 999))) System.out.println System.out System System.out 909 - (999 - Math.min(n, 999)) 909 (999 - Math.min(n, 999)) 999 Math.min(n, 999) Math.min Math n 999 {
            System.out.println(90909 - (99999 - Math.min(n, 99999)));
        } System.out.println(90909 - (99999 - Math.min(n, 99999))) System.out.println System.out System System.out 90909 - (99999 - Math.min(n, 99999)) 90909 (99999 - Math.min(n, 99999)) 99999 Math.min(n, 99999) Math.min Math n 99999 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        if (n < 100) {
            System.out.println(9 - (9 - Math.min(n, 9)));
        } else if (n < 10000) {
            System.out.println(909 - (999 - Math.min(n, 999)));
        } else {
            System.out.println(90909 - (99999 - Math.min(n, 99999)));
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        if (n < 100) {
            System.out.println(9 - (9 - Math.min(n, 9)));
        } else if (n < 10000) {
            System.out.println(909 - (999 - Math.min(n, 999)));
        } else {
            System.out.println(90909 - (99999 - Math.min(n, 99999)));
        }
    }
} Main
import java.util.Scanner;

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

        if (n < 100) {
            System.out.println(9 - (9 - Math.min(n, 9)));
        } else if (n < 10000) {
            System.out.println(909 - (999 - Math.min(n, 999)));
        } else {
            System.out.println(90909 - (99999 - Math.min(n, 99999)));
        }
    }
}
