import java.util.Scanner;

public class Main{
	public static void main(String arge[]){
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		// 1 <= N <= 100000
		int printNum = 0;
		int ketasuu = cheackKetasuu(N);
		if(ketasuu == 1 ){
			printNum = N;
		}else if(ketasuu == 2){
			printNum = 9;
		}else if(ketasuu == 3){
			printNum = 9 + N -99;
		}else if(ketasuu == 4){
			printNum = 9 + 900;
		}else if(ketasuu == 5){
			printNum = 9 + 900 + N - 9999;
		}else if(ketasuu == 6){
			printNum = 9 + 900 + 90000;
		}
		// System.out.println(ketasuu);
		System.out.println(printNum);

	}

	public static int cheackKetasuu(int N){
		int ketasuu = 0;
		int count = 6;
		for(int i = 100000;1 <= i;i /=10){
			if(1 <= N / i){
				ketasuu = count;
				break;
			}
			count --;
		}
		return ketasuu;
	}
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz