import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();

		if (n<10) {
			System.out.println(n);
		}else if (n< 100) {
			System.out.println(9);
		}else if (n< 1000) {
			System.out.println(9+n-99);
		}else if (n< 10000) {
			System.out.println(909);
		}else if (n< 100000) {
			System.out.println(909+n-9999);
		}else {
			System.out.println(90909);
		}
		
		sc.close();
	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();

		if (n<10) {
			System.out.println(n);
		}else if (n< 100) {
			System.out.println(9);
		}else if (n< 1000) {
			System.out.println(9+n-99);
		}else if (n< 10000) {
			System.out.println(909);
		}else if (n< 100000) {
			System.out.println(909+n-9999);
		}else {
			System.out.println(90909);
		}
		
		sc.close();
	}

} Main public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();

		if (n<10) {
			System.out.println(n);
		}else if (n< 100) {
			System.out.println(9);
		}else if (n< 1000) {
			System.out.println(9+n-99);
		}else if (n< 10000) {
			System.out.println(909);
		}else if (n< 100000) {
			System.out.println(909+n-9999);
		}else {
			System.out.println(90909);
		}
		
		sc.close();
	} main {
		
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();

		if (n<10) {
			System.out.println(n);
		}else if (n< 100) {
			System.out.println(9);
		}else if (n< 1000) {
			System.out.println(9+n-99);
		}else if (n< 10000) {
			System.out.println(909);
		}else if (n< 100000) {
			System.out.println(909+n-9999);
		}else {
			System.out.println(90909);
		}
		
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long n = sc.nextLong(); n sc.nextLong() sc.nextLong sc if (n<10) {
			System.out.println(n);
		}else if (n< 100) {
			System.out.println(9);
		}else if (n< 1000) {
			System.out.println(9+n-99);
		}else if (n< 10000) {
			System.out.println(909);
		}else if (n< 100000) {
			System.out.println(909+n-9999);
		}else {
			System.out.println(90909);
		} n<10 n 10 {
			System.out.println(n);
		} System.out.println(n) System.out.println System.out System System.out n if (n< 100) {
			System.out.println(9);
		}else if (n< 1000) {
			System.out.println(9+n-99);
		}else if (n< 10000) {
			System.out.println(909);
		}else if (n< 100000) {
			System.out.println(909+n-9999);
		}else {
			System.out.println(90909);
		} n< 100 n 100 {
			System.out.println(9);
		} System.out.println(9) System.out.println System.out System System.out 9 if (n< 1000) {
			System.out.println(9+n-99);
		}else if (n< 10000) {
			System.out.println(909);
		}else if (n< 100000) {
			System.out.println(909+n-9999);
		}else {
			System.out.println(90909);
		} n< 1000 n 1000 {
			System.out.println(9+n-99);
		} System.out.println(9+n-99) System.out.println System.out System System.out 9+n-99 9+n 9 n 99 if (n< 10000) {
			System.out.println(909);
		}else if (n< 100000) {
			System.out.println(909+n-9999);
		}else {
			System.out.println(90909);
		} n< 10000 n 10000 {
			System.out.println(909);
		} System.out.println(909) System.out.println System.out System System.out 909 if (n< 100000) {
			System.out.println(909+n-9999);
		}else {
			System.out.println(90909);
		} n< 100000 n 100000 {
			System.out.println(909+n-9999);
		} System.out.println(909+n-9999) System.out.println System.out System System.out 909+n-9999 909+n 909 n 9999 {
			System.out.println(90909);
		} System.out.println(90909) System.out.println System.out System System.out 90909 sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();

		if (n<10) {
			System.out.println(n);
		}else if (n< 100) {
			System.out.println(9);
		}else if (n< 1000) {
			System.out.println(9+n-99);
		}else if (n< 10000) {
			System.out.println(909);
		}else if (n< 100000) {
			System.out.println(909+n-9999);
		}else {
			System.out.println(90909);
		}
		
		sc.close();
	}

} public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();

		if (n<10) {
			System.out.println(n);
		}else if (n< 100) {
			System.out.println(9);
		}else if (n< 1000) {
			System.out.println(9+n-99);
		}else if (n< 10000) {
			System.out.println(909);
		}else if (n< 100000) {
			System.out.println(909+n-9999);
		}else {
			System.out.println(90909);
		}
		
		sc.close();
	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();

		if (n<10) {
			System.out.println(n);
		}else if (n< 100) {
			System.out.println(9);
		}else if (n< 1000) {
			System.out.println(9+n-99);
		}else if (n< 10000) {
			System.out.println(909);
		}else if (n< 100000) {
			System.out.println(909+n-9999);
		}else {
			System.out.println(90909);
		}
		
		sc.close();
	}

}