
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		s.close();
		int numbers = 0;
		if(n <= 9) {
			numbers = n;
		}else if(n <= 99) {
			numbers = 9;	
		}else if(n <= 999) {
			numbers = n - 90;
		}else if(n <= 9999) {
			numbers = 909;
		}else if(n <= 99999){
			numbers = n - 9000 - 90; 
		}else {
			numbers = 90909;
		}
		System.out.println(numbers);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		s.close();
		int numbers = 0;
		if(n <= 9) {
			numbers = n;
		}else if(n <= 99) {
			numbers = 9;	
		}else if(n <= 999) {
			numbers = n - 90;
		}else if(n <= 9999) {
			numbers = 909;
		}else if(n <= 99999){
			numbers = n - 9000 - 90; 
		}else {
			numbers = 90909;
		}
		System.out.println(numbers);
	}

} Main public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		s.close();
		int numbers = 0;
		if(n <= 9) {
			numbers = n;
		}else if(n <= 99) {
			numbers = 9;	
		}else if(n <= 999) {
			numbers = n - 90;
		}else if(n <= 9999) {
			numbers = 909;
		}else if(n <= 99999){
			numbers = n - 9000 - 90; 
		}else {
			numbers = 90909;
		}
		System.out.println(numbers);
	} main {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		s.close();
		int numbers = 0;
		if(n <= 9) {
			numbers = n;
		}else if(n <= 99) {
			numbers = 9;	
		}else if(n <= 999) {
			numbers = n - 90;
		}else if(n <= 9999) {
			numbers = 909;
		}else if(n <= 99999){
			numbers = n - 9000 - 90; 
		}else {
			numbers = 90909;
		}
		System.out.println(numbers);
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int n = s.nextInt(); n s.nextInt() s.nextInt s s.close() s.close s int numbers = 0; numbers 0 if(n <= 9) {
			numbers = n;
		}else if(n <= 99) {
			numbers = 9;	
		}else if(n <= 999) {
			numbers = n - 90;
		}else if(n <= 9999) {
			numbers = 909;
		}else if(n <= 99999){
			numbers = n - 9000 - 90; 
		}else {
			numbers = 90909;
		} n <= 9 n 9 {
			numbers = n;
		} numbers = n numbers n if(n <= 99) {
			numbers = 9;	
		}else if(n <= 999) {
			numbers = n - 90;
		}else if(n <= 9999) {
			numbers = 909;
		}else if(n <= 99999){
			numbers = n - 9000 - 90; 
		}else {
			numbers = 90909;
		} n <= 99 n 99 {
			numbers = 9;	
		} numbers = 9 numbers 9 if(n <= 999) {
			numbers = n - 90;
		}else if(n <= 9999) {
			numbers = 909;
		}else if(n <= 99999){
			numbers = n - 9000 - 90; 
		}else {
			numbers = 90909;
		} n <= 999 n 999 {
			numbers = n - 90;
		} numbers = n - 90 numbers n - 90 n 90 if(n <= 9999) {
			numbers = 909;
		}else if(n <= 99999){
			numbers = n - 9000 - 90; 
		}else {
			numbers = 90909;
		} n <= 9999 n 9999 {
			numbers = 909;
		} numbers = 909 numbers 909 if(n <= 99999){
			numbers = n - 9000 - 90; 
		}else {
			numbers = 90909;
		} n <= 99999 n 99999 {
			numbers = n - 9000 - 90; 
		} numbers = n - 9000 - 90 numbers n - 9000 - 90 n - 9000 - 90 n 9000 90 {
			numbers = 90909;
		} numbers = 90909 numbers 90909 System.out.println(numbers) System.out.println System.out System System.out numbers String[] args args public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		s.close();
		int numbers = 0;
		if(n <= 9) {
			numbers = n;
		}else if(n <= 99) {
			numbers = 9;	
		}else if(n <= 999) {
			numbers = n - 90;
		}else if(n <= 9999) {
			numbers = 909;
		}else if(n <= 99999){
			numbers = n - 9000 - 90; 
		}else {
			numbers = 90909;
		}
		System.out.println(numbers);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		s.close();
		int numbers = 0;
		if(n <= 9) {
			numbers = n;
		}else if(n <= 99) {
			numbers = 9;	
		}else if(n <= 999) {
			numbers = n - 90;
		}else if(n <= 9999) {
			numbers = 909;
		}else if(n <= 99999){
			numbers = n - 9000 - 90; 
		}else {
			numbers = 90909;
		}
		System.out.println(numbers);
	}

} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		s.close();
		int numbers = 0;
		if(n <= 9) {
			numbers = n;
		}else if(n <= 99) {
			numbers = 9;	
		}else if(n <= 999) {
			numbers = n - 90;
		}else if(n <= 9999) {
			numbers = 909;
		}else if(n <= 99999){
			numbers = n - 9000 - 90; 
		}else {
			numbers = 90909;
		}
		System.out.println(numbers);
	}

}
