import java.io.*;

/**
 * Created by Ayushi on 04/08/2019.
 */

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        r.close();
        int ans = 0;
        int i;
        for (i = 1; i*10 <= n; i=i*100) {
            ans += (i*9);
        }
        ans += Math.max(n-i+1, 0);

        System.out.println(ans);
    }
} import java.io.*; io.* java public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        r.close();
        int ans = 0;
        int i;
        for (i = 1; i*10 <= n; i=i*100) {
            ans += (i*9);
        }
        ans += Math.max(n-i+1, 0);

        System.out.println(ans);
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        r.close();
        int ans = 0;
        int i;
        for (i = 1; i*10 <= n; i=i*100) {
            ans += (i*9);
        }
        ans += Math.max(n-i+1, 0);

        System.out.println(ans);
    } main {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        r.close();
        int ans = 0;
        int i;
        for (i = 1; i*10 <= n; i=i*100) {
            ans += (i*9);
        }
        ans += Math.max(n-i+1, 0);

        System.out.println(ans);
    } BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); r new BufferedReader(new InputStreamReader(System.in)) String[] temp = r.readLine().split(" "); temp r.readLine().split(" ") r.readLine().split r.readLine() r.readLine r " " int n = Integer.parseInt(temp[0]); n Integer.parseInt(temp[0]) Integer.parseInt Integer temp[0] temp 0 r.close() r.close r int ans = 0; ans 0 int i; i for (i = 1; i*10 <= n; i=i*100) {
            ans += (i*9);
        } i = 1; i = 1 i 1 i*10 <= n i*10 i 10 n i=i*100 i=i*100 i i*100 i 100 {
            ans += (i*9);
        } {
            ans += (i*9);
        } ans += (i*9) ans (i*9) i 9 ans += Math.max(n-i+1, 0) ans Math.max(n-i+1, 0) Math.max Math n-i+1 n-i n i 1 0 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        r.close();
        int ans = 0;
        int i;
        for (i = 1; i*10 <= n; i=i*100) {
            ans += (i*9);
        }
        ans += Math.max(n-i+1, 0);

        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        r.close();
        int ans = 0;
        int i;
        for (i = 1; i*10 <= n; i=i*100) {
            ans += (i*9);
        }
        ans += Math.max(n-i+1, 0);

        System.out.println(ans);
    }
} Main
import java.io.*;

/**
 * Created by Ayushi on 04/08/2019.
 */

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        r.close();
        int ans = 0;
        int i;
        for (i = 1; i*10 <= n; i=i*100) {
            ans += (i*9);
        }
        ans += Math.max(n-i+1, 0);

        System.out.println(ans);
    }
}
