import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        if (str.length() <= 1) {
            System.out.print(Integer.parseInt(str));
            return;
        }

        if (str.length() <= 2) {
            System.out.print(9);
            return;
        }

        if (str.length() <= 3) {
            System.out.print(9 + Integer.parseInt(str) - 99);
            return;
        }

        if (str.length() <= 4) {
            System.out.print(909);
            return;
        }

        if (str.length() <= 5) {
            System.out.print(909 + Integer.parseInt(str) - 9999);
            return;
        }

        if (str.length() == 6) {
            System.out.print(90909);
            return;
        }
    }

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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        if (str.length() <= 1) {
            System.out.print(Integer.parseInt(str));
            return;
        }

        if (str.length() <= 2) {
            System.out.print(9);
            return;
        }

        if (str.length() <= 3) {
            System.out.print(9 + Integer.parseInt(str) - 99);
            return;
        }

        if (str.length() <= 4) {
            System.out.print(909);
            return;
        }

        if (str.length() <= 5) {
            System.out.print(909 + Integer.parseInt(str) - 9999);
            return;
        }

        if (str.length() == 6) {
            System.out.print(90909);
            return;
        }
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        if (str.length() <= 1) {
            System.out.print(Integer.parseInt(str));
            return;
        }

        if (str.length() <= 2) {
            System.out.print(9);
            return;
        }

        if (str.length() <= 3) {
            System.out.print(9 + Integer.parseInt(str) - 99);
            return;
        }

        if (str.length() <= 4) {
            System.out.print(909);
            return;
        }

        if (str.length() <= 5) {
            System.out.print(909 + Integer.parseInt(str) - 9999);
            return;
        }

        if (str.length() == 6) {
            System.out.print(90909);
            return;
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        if (str.length() <= 1) {
            System.out.print(Integer.parseInt(str));
            return;
        }

        if (str.length() <= 2) {
            System.out.print(9);
            return;
        }

        if (str.length() <= 3) {
            System.out.print(9 + Integer.parseInt(str) - 99);
            return;
        }

        if (str.length() <= 4) {
            System.out.print(909);
            return;
        }

        if (str.length() <= 5) {
            System.out.print(909 + Integer.parseInt(str) - 9999);
            return;
        }

        if (str.length() == 6) {
            System.out.print(90909);
            return;
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc if (str.length() <= 1) {
            System.out.print(Integer.parseInt(str));
            return;
        } str.length() <= 1 str.length() str.length str 1 {
            System.out.print(Integer.parseInt(str));
            return;
        } System.out.print(Integer.parseInt(str)) System.out.print System.out System System.out Integer.parseInt(str) Integer.parseInt Integer str return; if (str.length() <= 2) {
            System.out.print(9);
            return;
        } str.length() <= 2 str.length() str.length str 2 {
            System.out.print(9);
            return;
        } System.out.print(9) System.out.print System.out System System.out 9 return; if (str.length() <= 3) {
            System.out.print(9 + Integer.parseInt(str) - 99);
            return;
        } str.length() <= 3 str.length() str.length str 3 {
            System.out.print(9 + Integer.parseInt(str) - 99);
            return;
        } System.out.print(9 + Integer.parseInt(str) - 99) System.out.print System.out System System.out 9 + Integer.parseInt(str) - 99 9 + Integer.parseInt(str) 9 Integer.parseInt(str) Integer.parseInt Integer str 99 return; if (str.length() <= 4) {
            System.out.print(909);
            return;
        } str.length() <= 4 str.length() str.length str 4 {
            System.out.print(909);
            return;
        } System.out.print(909) System.out.print System.out System System.out 909 return; if (str.length() <= 5) {
            System.out.print(909 + Integer.parseInt(str) - 9999);
            return;
        } str.length() <= 5 str.length() str.length str 5 {
            System.out.print(909 + Integer.parseInt(str) - 9999);
            return;
        } System.out.print(909 + Integer.parseInt(str) - 9999) System.out.print System.out System System.out 909 + Integer.parseInt(str) - 9999 909 + Integer.parseInt(str) 909 Integer.parseInt(str) Integer.parseInt Integer str 9999 return; if (str.length() == 6) {
            System.out.print(90909);
            return;
        } str.length() == 6 str.length() str.length str 6 {
            System.out.print(90909);
            return;
        } System.out.print(90909) System.out.print System.out System System.out 90909 return; String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        if (str.length() <= 1) {
            System.out.print(Integer.parseInt(str));
            return;
        }

        if (str.length() <= 2) {
            System.out.print(9);
            return;
        }

        if (str.length() <= 3) {
            System.out.print(9 + Integer.parseInt(str) - 99);
            return;
        }

        if (str.length() <= 4) {
            System.out.print(909);
            return;
        }

        if (str.length() <= 5) {
            System.out.print(909 + Integer.parseInt(str) - 9999);
            return;
        }

        if (str.length() == 6) {
            System.out.print(90909);
            return;
        }
    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        if (str.length() <= 1) {
            System.out.print(Integer.parseInt(str));
            return;
        }

        if (str.length() <= 2) {
            System.out.print(9);
            return;
        }

        if (str.length() <= 3) {
            System.out.print(9 + Integer.parseInt(str) - 99);
            return;
        }

        if (str.length() <= 4) {
            System.out.print(909);
            return;
        }

        if (str.length() <= 5) {
            System.out.print(909 + Integer.parseInt(str) - 9999);
            return;
        }

        if (str.length() == 6) {
            System.out.print(90909);
            return;
        }
    }

} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        if (str.length() <= 1) {
            System.out.print(Integer.parseInt(str));
            return;
        }

        if (str.length() <= 2) {
            System.out.print(9);
            return;
        }

        if (str.length() <= 3) {
            System.out.print(9 + Integer.parseInt(str) - 99);
            return;
        }

        if (str.length() <= 4) {
            System.out.print(909);
            return;
        }

        if (str.length() <= 5) {
            System.out.print(909 + Integer.parseInt(str) - 9999);
            return;
        }

        if (str.length() == 6) {
            System.out.print(90909);
            return;
        }
    }

}