import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        if(n < 10){
            ans = n;
        }else if(10 <= n && n < 100){
            ans = 9;
        }else if(100 <= n && n < 1000){
            ans = 10 + (n-100);
        }else if(1000 <= n && n < 10000){
            ans = 909;
        }else if(10000 <= n && n < 100000){
            ans = 910 + (n-10000);
        }else{
            ans = 90909;
        }
        System.out.println(ans);
        sc.close();

    }

} 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 ans = 0;
        if(n < 10){
            ans = n;
        }else if(10 <= n && n < 100){
            ans = 9;
        }else if(100 <= n && n < 1000){
            ans = 10 + (n-100);
        }else if(1000 <= n && n < 10000){
            ans = 909;
        }else if(10000 <= n && n < 100000){
            ans = 910 + (n-10000);
        }else{
            ans = 90909;
        }
        System.out.println(ans);
        sc.close();

    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        if(n < 10){
            ans = n;
        }else if(10 <= n && n < 100){
            ans = 9;
        }else if(100 <= n && n < 1000){
            ans = 10 + (n-100);
        }else if(1000 <= n && n < 10000){
            ans = 909;
        }else if(10000 <= n && n < 100000){
            ans = 910 + (n-10000);
        }else{
            ans = 90909;
        }
        System.out.println(ans);
        sc.close();

    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        if(n < 10){
            ans = n;
        }else if(10 <= n && n < 100){
            ans = 9;
        }else if(100 <= n && n < 1000){
            ans = 10 + (n-100);
        }else if(1000 <= n && n < 10000){
            ans = 909;
        }else if(10000 <= n && n < 100000){
            ans = 910 + (n-10000);
        }else{
            ans = 90909;
        }
        System.out.println(ans);
        sc.close();

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ans = 0; ans 0 if(n < 10){
            ans = n;
        }else if(10 <= n && n < 100){
            ans = 9;
        }else if(100 <= n && n < 1000){
            ans = 10 + (n-100);
        }else if(1000 <= n && n < 10000){
            ans = 909;
        }else if(10000 <= n && n < 100000){
            ans = 910 + (n-10000);
        }else{
            ans = 90909;
        } n < 10 n 10 {
            ans = n;
        } ans = n ans n if(10 <= n && n < 100){
            ans = 9;
        }else if(100 <= n && n < 1000){
            ans = 10 + (n-100);
        }else if(1000 <= n && n < 10000){
            ans = 909;
        }else if(10000 <= n && n < 100000){
            ans = 910 + (n-10000);
        }else{
            ans = 90909;
        } 10 <= n && n < 100 10 <= n 10 n n < 100 n 100 {
            ans = 9;
        } ans = 9 ans 9 if(100 <= n && n < 1000){
            ans = 10 + (n-100);
        }else if(1000 <= n && n < 10000){
            ans = 909;
        }else if(10000 <= n && n < 100000){
            ans = 910 + (n-10000);
        }else{
            ans = 90909;
        } 100 <= n && n < 1000 100 <= n 100 n n < 1000 n 1000 {
            ans = 10 + (n-100);
        } ans = 10 + (n-100) ans 10 + (n-100) 10 (n-100) n 100 if(1000 <= n && n < 10000){
            ans = 909;
        }else if(10000 <= n && n < 100000){
            ans = 910 + (n-10000);
        }else{
            ans = 90909;
        } 1000 <= n && n < 10000 1000 <= n 1000 n n < 10000 n 10000 {
            ans = 909;
        } ans = 909 ans 909 if(10000 <= n && n < 100000){
            ans = 910 + (n-10000);
        }else{
            ans = 90909;
        } 10000 <= n && n < 100000 10000 <= n 10000 n n < 100000 n 100000 {
            ans = 910 + (n-10000);
        } ans = 910 + (n-10000) ans 910 + (n-10000) 910 (n-10000) n 10000 {
            ans = 90909;
        } ans = 90909 ans 90909 System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        if(n < 10){
            ans = n;
        }else if(10 <= n && n < 100){
            ans = 9;
        }else if(100 <= n && n < 1000){
            ans = 10 + (n-100);
        }else if(1000 <= n && n < 10000){
            ans = 909;
        }else if(10000 <= n && n < 100000){
            ans = 910 + (n-10000);
        }else{
            ans = 90909;
        }
        System.out.println(ans);
        sc.close();

    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        if(n < 10){
            ans = n;
        }else if(10 <= n && n < 100){
            ans = 9;
        }else if(100 <= n && n < 1000){
            ans = 10 + (n-100);
        }else if(1000 <= n && n < 10000){
            ans = 909;
        }else if(10000 <= n && n < 100000){
            ans = 910 + (n-10000);
        }else{
            ans = 90909;
        }
        System.out.println(ans);
        sc.close();

    }

} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        if(n < 10){
            ans = n;
        }else if(10 <= n && n < 100){
            ans = 9;
        }else if(100 <= n && n < 1000){
            ans = 10 + (n-100);
        }else if(1000 <= n && n < 10000){
            ans = 909;
        }else if(10000 <= n && n < 100000){
            ans = 910 + (n-10000);
        }else{
            ans = 90909;
        }
        System.out.println(ans);
        sc.close();

    }

}
