import java.util.*;

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

    if(N<=9){
    System.out.println(N);
    }else if(N<=99){
    System.out.println("9");
    }else if(N<=999){
    System.out.println(N-99+9);
    }else if(N<=9999){
    System.out.println("909");
    }else if(N<=99999){
    System.out.println(N-9999+909);
    }else{
    System.out.println("90909");    
    }
}
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();

    if(N<=9){
    System.out.println(N);
    }else if(N<=99){
    System.out.println("9");
    }else if(N<=999){
    System.out.println(N-99+9);
    }else if(N<=9999){
    System.out.println("909");
    }else if(N<=99999){
    System.out.println(N-9999+909);
    }else{
    System.out.println("90909");    
    }
}
} Main public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();

    if(N<=9){
    System.out.println(N);
    }else if(N<=99){
    System.out.println("9");
    }else if(N<=999){
    System.out.println(N-99+9);
    }else if(N<=9999){
    System.out.println("909");
    }else if(N<=99999){
    System.out.println(N-9999+909);
    }else{
    System.out.println("90909");    
    }
} main {
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();

    if(N<=9){
    System.out.println(N);
    }else if(N<=99){
    System.out.println("9");
    }else if(N<=999){
    System.out.println(N-99+9);
    }else if(N<=9999){
    System.out.println("909");
    }else if(N<=99999){
    System.out.println(N-9999+909);
    }else{
    System.out.println("90909");    
    }
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc if(N<=9){
    System.out.println(N);
    }else if(N<=99){
    System.out.println("9");
    }else if(N<=999){
    System.out.println(N-99+9);
    }else if(N<=9999){
    System.out.println("909");
    }else if(N<=99999){
    System.out.println(N-9999+909);
    }else{
    System.out.println("90909");    
    } N<=9 N 9 {
    System.out.println(N);
    } System.out.println(N) System.out.println System.out System System.out N if(N<=99){
    System.out.println("9");
    }else if(N<=999){
    System.out.println(N-99+9);
    }else if(N<=9999){
    System.out.println("909");
    }else if(N<=99999){
    System.out.println(N-9999+909);
    }else{
    System.out.println("90909");    
    } N<=99 N 99 {
    System.out.println("9");
    } System.out.println("9") System.out.println System.out System System.out "9" if(N<=999){
    System.out.println(N-99+9);
    }else if(N<=9999){
    System.out.println("909");
    }else if(N<=99999){
    System.out.println(N-9999+909);
    }else{
    System.out.println("90909");    
    } N<=999 N 999 {
    System.out.println(N-99+9);
    } System.out.println(N-99+9) System.out.println System.out System System.out N-99+9 N-99 N 99 9 if(N<=9999){
    System.out.println("909");
    }else if(N<=99999){
    System.out.println(N-9999+909);
    }else{
    System.out.println("90909");    
    } N<=9999 N 9999 {
    System.out.println("909");
    } System.out.println("909") System.out.println System.out System System.out "909" if(N<=99999){
    System.out.println(N-9999+909);
    }else{
    System.out.println("90909");    
    } N<=99999 N 99999 {
    System.out.println(N-9999+909);
    } System.out.println(N-9999+909) System.out.println System.out System System.out N-9999+909 N-9999 N 9999 909 {
    System.out.println("90909");    
    } System.out.println("90909") System.out.println System.out System System.out "90909" String[] args args public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();

    if(N<=9){
    System.out.println(N);
    }else if(N<=99){
    System.out.println("9");
    }else if(N<=999){
    System.out.println(N-99+9);
    }else if(N<=9999){
    System.out.println("909");
    }else if(N<=99999){
    System.out.println(N-9999+909);
    }else{
    System.out.println("90909");    
    }
}
} public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();

    if(N<=9){
    System.out.println(N);
    }else if(N<=99){
    System.out.println("9");
    }else if(N<=999){
    System.out.println(N-99+9);
    }else if(N<=9999){
    System.out.println("909");
    }else if(N<=99999){
    System.out.println(N-9999+909);
    }else{
    System.out.println("90909");    
    }
}
} Main
import java.util.*;

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

    if(N<=9){
    System.out.println(N);
    }else if(N<=99){
    System.out.println("9");
    }else if(N<=999){
    System.out.println(N-99+9);
    }else if(N<=9999){
    System.out.println("909");
    }else if(N<=99999){
    System.out.println(N-9999+909);
    }else{
    System.out.println("90909");    
    }
}
}