import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int sum = 0;
        if (a - 10 >= 0) {
            sum += 9;
            if (a - 10 >= 0 && a - 99 <= 0) {
                System.out.println(sum);
            }
        } else if (10 - a > 0) {
            System.out.println(a);
        }
        if (a - 1000 >= 0) {
            sum += 900;
            if (a - 1000 >= 0 && a - 9999 <= 0) {
                System.out.println(sum);
            }
        } else if (a - 100 >= 0) {
            System.out.println(9 + a - 99);
        }
        if (a - 100000 >= 0) {
            sum = 90909;
            System.out.println(sum);
        } else if (a - 10000 >= 0) {
            System.out.println(9 + 900 + a - 9999);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main{

    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int sum = 0;
        if (a - 10 >= 0) {
            sum += 9;
            if (a - 10 >= 0 && a - 99 <= 0) {
                System.out.println(sum);
            }
        } else if (10 - a > 0) {
            System.out.println(a);
        }
        if (a - 1000 >= 0) {
            sum += 900;
            if (a - 1000 >= 0 && a - 9999 <= 0) {
                System.out.println(sum);
            }
        } else if (a - 100 >= 0) {
            System.out.println(9 + a - 99);
        }
        if (a - 100000 >= 0) {
            sum = 90909;
            System.out.println(sum);
        } else if (a - 10000 >= 0) {
            System.out.println(9 + 900 + a - 9999);
        }
    }
} Main public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int sum = 0;
        if (a - 10 >= 0) {
            sum += 9;
            if (a - 10 >= 0 && a - 99 <= 0) {
                System.out.println(sum);
            }
        } else if (10 - a > 0) {
            System.out.println(a);
        }
        if (a - 1000 >= 0) {
            sum += 900;
            if (a - 1000 >= 0 && a - 9999 <= 0) {
                System.out.println(sum);
            }
        } else if (a - 100 >= 0) {
            System.out.println(9 + a - 99);
        }
        if (a - 100000 >= 0) {
            sum = 90909;
            System.out.println(sum);
        } else if (a - 10000 >= 0) {
            System.out.println(9 + 900 + a - 9999);
        }
    } main {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int sum = 0;
        if (a - 10 >= 0) {
            sum += 9;
            if (a - 10 >= 0 && a - 99 <= 0) {
                System.out.println(sum);
            }
        } else if (10 - a > 0) {
            System.out.println(a);
        }
        if (a - 1000 >= 0) {
            sum += 900;
            if (a - 1000 >= 0 && a - 9999 <= 0) {
                System.out.println(sum);
            }
        } else if (a - 100 >= 0) {
            System.out.println(9 + a - 99);
        }
        if (a - 100000 >= 0) {
            sum = 90909;
            System.out.println(sum);
        } else if (a - 10000 >= 0) {
            System.out.println(9 + 900 + a - 9999);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int sum = 0; sum 0 if (a - 10 >= 0) {
            sum += 9;
            if (a - 10 >= 0 && a - 99 <= 0) {
                System.out.println(sum);
            }
        } else if (10 - a > 0) {
            System.out.println(a);
        } a - 10 >= 0 a - 10 a 10 0 {
            sum += 9;
            if (a - 10 >= 0 && a - 99 <= 0) {
                System.out.println(sum);
            }
        } sum += 9 sum 9 if (a - 10 >= 0 && a - 99 <= 0) {
                System.out.println(sum);
            } a - 10 >= 0 && a - 99 <= 0 a - 10 >= 0 a - 10 a 10 0 a - 99 <= 0 a - 99 a 99 0 {
                System.out.println(sum);
            } System.out.println(sum) System.out.println System.out System System.out sum if (10 - a > 0) {
            System.out.println(a);
        } 10 - a > 0 10 - a 10 a 0 {
            System.out.println(a);
        } System.out.println(a) System.out.println System.out System System.out a if (a - 1000 >= 0) {
            sum += 900;
            if (a - 1000 >= 0 && a - 9999 <= 0) {
                System.out.println(sum);
            }
        } else if (a - 100 >= 0) {
            System.out.println(9 + a - 99);
        } a - 1000 >= 0 a - 1000 a 1000 0 {
            sum += 900;
            if (a - 1000 >= 0 && a - 9999 <= 0) {
                System.out.println(sum);
            }
        } sum += 900 sum 900 if (a - 1000 >= 0 && a - 9999 <= 0) {
                System.out.println(sum);
            } a - 1000 >= 0 && a - 9999 <= 0 a - 1000 >= 0 a - 1000 a 1000 0 a - 9999 <= 0 a - 9999 a 9999 0 {
                System.out.println(sum);
            } System.out.println(sum) System.out.println System.out System System.out sum if (a - 100 >= 0) {
            System.out.println(9 + a - 99);
        } a - 100 >= 0 a - 100 a 100 0 {
            System.out.println(9 + a - 99);
        } System.out.println(9 + a - 99) System.out.println System.out System System.out 9 + a - 99 9 + a 9 a 99 if (a - 100000 >= 0) {
            sum = 90909;
            System.out.println(sum);
        } else if (a - 10000 >= 0) {
            System.out.println(9 + 900 + a - 9999);
        } a - 100000 >= 0 a - 100000 a 100000 0 {
            sum = 90909;
            System.out.println(sum);
        } sum = 90909 sum 90909 System.out.println(sum) System.out.println System.out System System.out sum if (a - 10000 >= 0) {
            System.out.println(9 + 900 + a - 9999);
        } a - 10000 >= 0 a - 10000 a 10000 0 {
            System.out.println(9 + 900 + a - 9999);
        } System.out.println(9 + 900 + a - 9999) System.out.println System.out System System.out 9 + 900 + a - 9999 9 + 900 + a 9 + 900 + a 9 900 a 9999 String[] args args public class Main{

    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int sum = 0;
        if (a - 10 >= 0) {
            sum += 9;
            if (a - 10 >= 0 && a - 99 <= 0) {
                System.out.println(sum);
            }
        } else if (10 - a > 0) {
            System.out.println(a);
        }
        if (a - 1000 >= 0) {
            sum += 900;
            if (a - 1000 >= 0 && a - 9999 <= 0) {
                System.out.println(sum);
            }
        } else if (a - 100 >= 0) {
            System.out.println(9 + a - 99);
        }
        if (a - 100000 >= 0) {
            sum = 90909;
            System.out.println(sum);
        } else if (a - 10000 >= 0) {
            System.out.println(9 + 900 + a - 9999);
        }
    }
} public class Main{

    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int sum = 0;
        if (a - 10 >= 0) {
            sum += 9;
            if (a - 10 >= 0 && a - 99 <= 0) {
                System.out.println(sum);
            }
        } else if (10 - a > 0) {
            System.out.println(a);
        }
        if (a - 1000 >= 0) {
            sum += 900;
            if (a - 1000 >= 0 && a - 9999 <= 0) {
                System.out.println(sum);
            }
        } else if (a - 100 >= 0) {
            System.out.println(9 + a - 99);
        }
        if (a - 100000 >= 0) {
            sum = 90909;
            System.out.println(sum);
        } else if (a - 10000 >= 0) {
            System.out.println(9 + 900 + a - 9999);
        }
    }
} Main
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int sum = 0;
        if (a - 10 >= 0) {
            sum += 9;
            if (a - 10 >= 0 && a - 99 <= 0) {
                System.out.println(sum);
            }
        } else if (10 - a > 0) {
            System.out.println(a);
        }
        if (a - 1000 >= 0) {
            sum += 900;
            if (a - 1000 >= 0 && a - 9999 <= 0) {
                System.out.println(sum);
            }
        } else if (a - 100 >= 0) {
            System.out.println(9 + a - 99);
        }
        if (a - 100000 >= 0) {
            sum = 90909;
            System.out.println(sum);
        } else if (a - 10000 >= 0) {
            System.out.println(9 + 900 + a - 9999);
        }
    }
}
