import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        exec();
    }

    static void exec() {
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int length = String.valueOf(n).length();

        if(length % 2 == 0) {
            StringBuilder sb = new StringBuilder();
            for (int i = length-1; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            out.print(sb);
        } else if(length == 1) {
            out.print(n);
        } else {
            int count = 0;
            int base = 1;
            for (int i = 0; i <length-1 ; i++) {
                base = base * 10;
            }
            count = count + (n - base) + 1;

            StringBuilder sb = new StringBuilder();
            for (int i = length - 2; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            count = count + Integer.parseInt(sb.toString());
            out.print(count);

        }

        out.flush();

    }

} import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        exec();
    }

    static void exec() {
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int length = String.valueOf(n).length();

        if(length % 2 == 0) {
            StringBuilder sb = new StringBuilder();
            for (int i = length-1; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            out.print(sb);
        } else if(length == 1) {
            out.print(n);
        } else {
            int count = 0;
            int base = 1;
            for (int i = 0; i <length-1 ; i++) {
                base = base * 10;
            }
            count = count + (n - base) + 1;

            StringBuilder sb = new StringBuilder();
            for (int i = length - 2; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            count = count + Integer.parseInt(sb.toString());
            out.print(count);

        }

        out.flush();

    }

} Main public static void main(String[] args) {
        exec();
    } main {
        exec();
    } exec() exec String[] args args static void exec() {
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int length = String.valueOf(n).length();

        if(length % 2 == 0) {
            StringBuilder sb = new StringBuilder();
            for (int i = length-1; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            out.print(sb);
        } else if(length == 1) {
            out.print(n);
        } else {
            int count = 0;
            int base = 1;
            for (int i = 0; i <length-1 ; i++) {
                base = base * 10;
            }
            count = count + (n - base) + 1;

            StringBuilder sb = new StringBuilder();
            for (int i = length - 2; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            count = count + Integer.parseInt(sb.toString());
            out.print(count);

        }

        out.flush();

    } exec {
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int length = String.valueOf(n).length();

        if(length % 2 == 0) {
            StringBuilder sb = new StringBuilder();
            for (int i = length-1; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            out.print(sb);
        } else if(length == 1) {
            out.print(n);
        } else {
            int count = 0;
            int base = 1;
            for (int i = 0; i <length-1 ; i++) {
                base = base * 10;
            }
            count = count + (n - base) + 1;

            StringBuilder sb = new StringBuilder();
            for (int i = length - 2; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            count = count + Integer.parseInt(sb.toString());
            out.print(count);

        }

        out.flush();

    } PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next 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 % 2 == 0) {
            StringBuilder sb = new StringBuilder();
            for (int i = length-1; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            out.print(sb);
        } else if(length == 1) {
            out.print(n);
        } else {
            int count = 0;
            int base = 1;
            for (int i = 0; i <length-1 ; i++) {
                base = base * 10;
            }
            count = count + (n - base) + 1;

            StringBuilder sb = new StringBuilder();
            for (int i = length - 2; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            count = count + Integer.parseInt(sb.toString());
            out.print(count);

        } length % 2 == 0 length % 2 length 2 0 {
            StringBuilder sb = new StringBuilder();
            for (int i = length-1; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            out.print(sb);
        } StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i = length-1; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            } int i = length-1; int i = length-1; i length-1 length 1 i > 0 i 0 i-- i-- i {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            } {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            } if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                } i % 2 == 0 i % 2 i 2 0 {
                    sb.append("0");
                } sb.append("0") sb.append sb "0" {
                    sb.append("9");
                } sb.append("9") sb.append sb "9" out.print(sb) out.print out sb if(length == 1) {
            out.print(n);
        } else {
            int count = 0;
            int base = 1;
            for (int i = 0; i <length-1 ; i++) {
                base = base * 10;
            }
            count = count + (n - base) + 1;

            StringBuilder sb = new StringBuilder();
            for (int i = length - 2; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            count = count + Integer.parseInt(sb.toString());
            out.print(count);

        } length == 1 length 1 {
            out.print(n);
        } out.print(n) out.print out n {
            int count = 0;
            int base = 1;
            for (int i = 0; i <length-1 ; i++) {
                base = base * 10;
            }
            count = count + (n - base) + 1;

            StringBuilder sb = new StringBuilder();
            for (int i = length - 2; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            count = count + Integer.parseInt(sb.toString());
            out.print(count);

        } int count = 0; count 0 int base = 1; base 1 for (int i = 0; i <length-1 ; i++) {
                base = base * 10;
            } int i = 0; int i = 0; i 0 i <length-1 i length-1 length 1 i++ i++ i {
                base = base * 10;
            } {
                base = base * 10;
            } base = base * 10 base base * 10 base 10 count = count + (n - base) + 1 count count + (n - base) + 1 count + (n - base) + 1 count (n - base) n base 1 StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i = length - 2; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            } int i = length - 2; int i = length - 2; i length - 2 length 2 i > 0 i 0 i-- i-- i {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            } {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            } if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                } i % 2 == 0 i % 2 i 2 0 {
                    sb.append("0");
                } sb.append("0") sb.append sb "0" {
                    sb.append("9");
                } sb.append("9") sb.append sb "9" count = count + Integer.parseInt(sb.toString()) count count + Integer.parseInt(sb.toString()) count Integer.parseInt(sb.toString()) Integer.parseInt Integer sb.toString() sb.toString sb out.print(count) out.print out count out.flush() out.flush out public class Main {

    public static void main(String[] args) {
        exec();
    }

    static void exec() {
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int length = String.valueOf(n).length();

        if(length % 2 == 0) {
            StringBuilder sb = new StringBuilder();
            for (int i = length-1; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            out.print(sb);
        } else if(length == 1) {
            out.print(n);
        } else {
            int count = 0;
            int base = 1;
            for (int i = 0; i <length-1 ; i++) {
                base = base * 10;
            }
            count = count + (n - base) + 1;

            StringBuilder sb = new StringBuilder();
            for (int i = length - 2; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            count = count + Integer.parseInt(sb.toString());
            out.print(count);

        }

        out.flush();

    }

} public class Main {

    public static void main(String[] args) {
        exec();
    }

    static void exec() {
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int length = String.valueOf(n).length();

        if(length % 2 == 0) {
            StringBuilder sb = new StringBuilder();
            for (int i = length-1; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            out.print(sb);
        } else if(length == 1) {
            out.print(n);
        } else {
            int count = 0;
            int base = 1;
            for (int i = 0; i <length-1 ; i++) {
                base = base * 10;
            }
            count = count + (n - base) + 1;

            StringBuilder sb = new StringBuilder();
            for (int i = length - 2; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            count = count + Integer.parseInt(sb.toString());
            out.print(count);

        }

        out.flush();

    }

} Main
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        exec();
    }

    static void exec() {
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int length = String.valueOf(n).length();

        if(length % 2 == 0) {
            StringBuilder sb = new StringBuilder();
            for (int i = length-1; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            out.print(sb);
        } else if(length == 1) {
            out.print(n);
        } else {
            int count = 0;
            int base = 1;
            for (int i = 0; i <length-1 ; i++) {
                base = base * 10;
            }
            count = count + (n - base) + 1;

            StringBuilder sb = new StringBuilder();
            for (int i = length - 2; i > 0; i--) {
                if(i % 2 == 0) {
                    sb.append("0");
                } else {
                    sb.append("9");
                }
            }
            count = count + Integer.parseInt(sb.toString());
            out.print(count);

        }

        out.flush();

    }

}
