
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();
		
		if(n<10) {
			System.out.println(n);
			return;
		}
		if(n<100) {
			System.out.println(9);
			return;
		}
		if(n<1000) {
			System.out.println(n-99+9);
			return;
		}
		if(n<10000) {
			System.out.println(909);
		return;
		}
		if(n<100000) {
			System.out.println(n-9999+909);
			return;
		}
		System.out.println(90909);
	}

} 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();
		
		if(n<10) {
			System.out.println(n);
			return;
		}
		if(n<100) {
			System.out.println(9);
			return;
		}
		if(n<1000) {
			System.out.println(n-99+9);
			return;
		}
		if(n<10000) {
			System.out.println(909);
		return;
		}
		if(n<100000) {
			System.out.println(n-9999+909);
			return;
		}
		System.out.println(90909);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		
		if(n<10) {
			System.out.println(n);
			return;
		}
		if(n<100) {
			System.out.println(9);
			return;
		}
		if(n<1000) {
			System.out.println(n-99+9);
			return;
		}
		if(n<10000) {
			System.out.println(909);
		return;
		}
		if(n<100000) {
			System.out.println(n-9999+909);
			return;
		}
		System.out.println(90909);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		
		if(n<10) {
			System.out.println(n);
			return;
		}
		if(n<100) {
			System.out.println(9);
			return;
		}
		if(n<1000) {
			System.out.println(n-99+9);
			return;
		}
		if(n<10000) {
			System.out.println(909);
		return;
		}
		if(n<100000) {
			System.out.println(n-9999+909);
			return;
		}
		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 sc.close() sc.close sc if(n<10) {
			System.out.println(n);
			return;
		} n<10 n 10 {
			System.out.println(n);
			return;
		} System.out.println(n) System.out.println System.out System System.out n return; if(n<100) {
			System.out.println(9);
			return;
		} n<100 n 100 {
			System.out.println(9);
			return;
		} System.out.println(9) System.out.println System.out System System.out 9 return; if(n<1000) {
			System.out.println(n-99+9);
			return;
		} n<1000 n 1000 {
			System.out.println(n-99+9);
			return;
		} System.out.println(n-99+9) System.out.println System.out System System.out n-99+9 n-99 n 99 9 return; if(n<10000) {
			System.out.println(909);
		return;
		} n<10000 n 10000 {
			System.out.println(909);
		return;
		} System.out.println(909) System.out.println System.out System System.out 909 return; if(n<100000) {
			System.out.println(n-9999+909);
			return;
		} n<100000 n 100000 {
			System.out.println(n-9999+909);
			return;
		} System.out.println(n-9999+909) System.out.println System.out System System.out n-9999+909 n-9999 n 9999 909 return; 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();
		sc.close();
		
		if(n<10) {
			System.out.println(n);
			return;
		}
		if(n<100) {
			System.out.println(9);
			return;
		}
		if(n<1000) {
			System.out.println(n-99+9);
			return;
		}
		if(n<10000) {
			System.out.println(909);
		return;
		}
		if(n<100000) {
			System.out.println(n-9999+909);
			return;
		}
		System.out.println(90909);
	}

} public class Main {

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

} 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();
		
		if(n<10) {
			System.out.println(n);
			return;
		}
		if(n<100) {
			System.out.println(9);
			return;
		}
		if(n<1000) {
			System.out.println(n-99+9);
			return;
		}
		if(n<10000) {
			System.out.println(909);
		return;
		}
		if(n<100000) {
			System.out.println(n-9999+909);
			return;
		}
		System.out.println(90909);
	}

}
