import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		// Nの入力
		int N = sc.nextInt();
		
		// Nの桁数
		int digit = String.valueOf(N).length();
				
		// 結果の出力
		int count = 0;
		switch (digit) {
			case 1:
				count = N;
				break;
			case 2:
				count = 9;
				break;
			case 3:
				count = N - 90;
				break;
			case 4:
				count = 999 - 90;
				break;
			case 5:
				count = N - 90 - 9000;
				break;
			case 6:
				count = 99999 - 90 - 9000;
				break;
		}
		System.out.println(count);
		
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		// Nの入力
		int N = sc.nextInt();
		
		// Nの桁数
		int digit = String.valueOf(N).length();
				
		// 結果の出力
		int count = 0;
		switch (digit) {
			case 1:
				count = N;
				break;
			case 2:
				count = 9;
				break;
			case 3:
				count = N - 90;
				break;
			case 4:
				count = 999 - 90;
				break;
			case 5:
				count = N - 90 - 9000;
				break;
			case 6:
				count = 99999 - 90 - 9000;
				break;
		}
		System.out.println(count);
		
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		// Nの入力
		int N = sc.nextInt();
		
		// Nの桁数
		int digit = String.valueOf(N).length();
				
		// 結果の出力
		int count = 0;
		switch (digit) {
			case 1:
				count = N;
				break;
			case 2:
				count = 9;
				break;
			case 3:
				count = N - 90;
				break;
			case 4:
				count = 999 - 90;
				break;
			case 5:
				count = N - 90 - 9000;
				break;
			case 6:
				count = 99999 - 90 - 9000;
				break;
		}
		System.out.println(count);
		
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		
		// Nの入力
		int N = sc.nextInt();
		
		// Nの桁数
		int digit = String.valueOf(N).length();
				
		// 結果の出力
		int count = 0;
		switch (digit) {
			case 1:
				count = N;
				break;
			case 2:
				count = 9;
				break;
			case 3:
				count = N - 90;
				break;
			case 4:
				count = 999 - 90;
				break;
			case 5:
				count = N - 90 - 9000;
				break;
			case 6:
				count = 99999 - 90 - 9000;
				break;
		}
		System.out.println(count);
		
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int digit = String.valueOf(N).length(); digit String.valueOf(N).length() String.valueOf(N).length String.valueOf(N) String.valueOf String N int count = 0; count 0 switch (digit) {
			case 1:
				count = N;
				break;
			case 2:
				count = 9;
				break;
			case 3:
				count = N - 90;
				break;
			case 4:
				count = 999 - 90;
				break;
			case 5:
				count = N - 90 - 9000;
				break;
			case 6:
				count = 99999 - 90 - 9000;
				break;
		} digit case 1: 1 case 1: count = N count N break; case 2: 2 case 2: count = 9 count 9 break; case 3: 3 case 3: count = N - 90 count N - 90 N 90 break; case 4: 4 case 4: count = 999 - 90 count 999 - 90 999 90 break; case 5: 5 case 5: count = N - 90 - 9000 count N - 90 - 9000 N - 90 - 9000 N 90 9000 break; case 6: 6 case 6: count = 99999 - 90 - 9000 count 99999 - 90 - 9000 99999 - 90 - 9000 99999 90 9000 break; System.out.println(count) System.out.println System.out System System.out count sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		// Nの入力
		int N = sc.nextInt();
		
		// Nの桁数
		int digit = String.valueOf(N).length();
				
		// 結果の出力
		int count = 0;
		switch (digit) {
			case 1:
				count = N;
				break;
			case 2:
				count = 9;
				break;
			case 3:
				count = N - 90;
				break;
			case 4:
				count = 999 - 90;
				break;
			case 5:
				count = N - 90 - 9000;
				break;
			case 6:
				count = 99999 - 90 - 9000;
				break;
		}
		System.out.println(count);
		
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		// Nの入力
		int N = sc.nextInt();
		
		// Nの桁数
		int digit = String.valueOf(N).length();
				
		// 結果の出力
		int count = 0;
		switch (digit) {
			case 1:
				count = N;
				break;
			case 2:
				count = 9;
				break;
			case 3:
				count = N - 90;
				break;
			case 4:
				count = 999 - 90;
				break;
			case 5:
				count = N - 90 - 9000;
				break;
			case 6:
				count = 99999 - 90 - 9000;
				break;
		}
		System.out.println(count);
		
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		// Nの入力
		int N = sc.nextInt();
		
		// Nの桁数
		int digit = String.valueOf(N).length();
				
		// 結果の出力
		int count = 0;
		switch (digit) {
			case 1:
				count = N;
				break;
			case 2:
				count = 9;
				break;
			case 3:
				count = N - 90;
				break;
			case 4:
				count = 999 - 90;
				break;
			case 5:
				count = N - 90 - 9000;
				break;
			case 6:
				count = 99999 - 90 - 9000;
				break;
		}
		System.out.println(count);
		
		sc.close();
	}
}
