import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		sc.close();
		int sum=0;
		if(n<10) {//1~10
			sum=n;
		}else if(n<100){//10~100
			sum=9;
		}else if(n<1000){//100~1000
			sum=n-90;
		}else if(n<10000) {//1000~10000
			sum=909;
		}else if(n<100000){//10000~100000
			sum=n-9090;
		}else {
			sum=90909;
		}
		System.out.println(sum);
	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		sc.close();
		int sum=0;
		if(n<10) {//1~10
			sum=n;
		}else if(n<100){//10~100
			sum=9;
		}else if(n<1000){//100~1000
			sum=n-90;
		}else if(n<10000) {//1000~10000
			sum=909;
		}else if(n<100000){//10000~100000
			sum=n-9090;
		}else {
			sum=90909;
		}
		System.out.println(sum);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		sc.close();
		int sum=0;
		if(n<10) {//1~10
			sum=n;
		}else if(n<100){//10~100
			sum=9;
		}else if(n<1000){//100~1000
			sum=n-90;
		}else if(n<10000) {//1000~10000
			sum=909;
		}else if(n<100000){//10000~100000
			sum=n-9090;
		}else {
			sum=90909;
		}
		System.out.println(sum);
	} main {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		sc.close();
		int sum=0;
		if(n<10) {//1~10
			sum=n;
		}else if(n<100){//10~100
			sum=9;
		}else if(n<1000){//100~1000
			sum=n-90;
		}else if(n<10000) {//1000~10000
			sum=909;
		}else if(n<100000){//10000~100000
			sum=n-9090;
		}else {
			sum=90909;
		}
		System.out.println(sum);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc sc.close() sc.close sc int sum=0; sum 0 if(n<10) {//1~10
			sum=n;
		}else if(n<100){//10~100
			sum=9;
		}else if(n<1000){//100~1000
			sum=n-90;
		}else if(n<10000) {//1000~10000
			sum=909;
		}else if(n<100000){//10000~100000
			sum=n-9090;
		}else {
			sum=90909;
		} n<10 n 10 {//1~10
			sum=n;
		} sum=n sum n if(n<100){//10~100
			sum=9;
		}else if(n<1000){//100~1000
			sum=n-90;
		}else if(n<10000) {//1000~10000
			sum=909;
		}else if(n<100000){//10000~100000
			sum=n-9090;
		}else {
			sum=90909;
		} n<100 n 100 {//10~100
			sum=9;
		} sum=9 sum 9 if(n<1000){//100~1000
			sum=n-90;
		}else if(n<10000) {//1000~10000
			sum=909;
		}else if(n<100000){//10000~100000
			sum=n-9090;
		}else {
			sum=90909;
		} n<1000 n 1000 {//100~1000
			sum=n-90;
		} sum=n-90 sum n-90 n 90 if(n<10000) {//1000~10000
			sum=909;
		}else if(n<100000){//10000~100000
			sum=n-9090;
		}else {
			sum=90909;
		} n<10000 n 10000 {//1000~10000
			sum=909;
		} sum=909 sum 909 if(n<100000){//10000~100000
			sum=n-9090;
		}else {
			sum=90909;
		} n<100000 n 100000 {//10000~100000
			sum=n-9090;
		} sum=n-9090 sum n-9090 n 9090 {
			sum=90909;
		} sum=90909 sum 90909 System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		sc.close();
		int sum=0;
		if(n<10) {//1~10
			sum=n;
		}else if(n<100){//10~100
			sum=9;
		}else if(n<1000){//100~1000
			sum=n-90;
		}else if(n<10000) {//1000~10000
			sum=909;
		}else if(n<100000){//10000~100000
			sum=n-9090;
		}else {
			sum=90909;
		}
		System.out.println(sum);
	}

} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		sc.close();
		int sum=0;
		if(n<10) {//1~10
			sum=n;
		}else if(n<100){//10~100
			sum=9;
		}else if(n<1000){//100~1000
			sum=n-90;
		}else if(n<10000) {//1000~10000
			sum=909;
		}else if(n<100000){//10000~100000
			sum=n-9090;
		}else {
			sum=90909;
		}
		System.out.println(sum);
	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		sc.close();
		int sum=0;
		if(n<10) {//1~10
			sum=n;
		}else if(n<100){//10~100
			sum=9;
		}else if(n<1000){//100~1000
			sum=n-90;
		}else if(n<10000) {//1000~10000
			sum=909;
		}else if(n<100000){//10000~100000
			sum=n-9090;
		}else {
			sum=90909;
		}
		System.out.println(sum);
	}

}
