import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sn = new Scanner(System.in);
		
		int n = sn.nextInt();
		int len = String.valueOf(n).length();
		
		switch (len) {
		case 1:
			System.out.println(n);
			break;
		case 2:
			System.out.println(9);
			break;
		case 3:
			System.out.println(n - 90);
			break;
		case 4:
			System.out.println(900 + 9);
			break;
		case 5:
			System.out.println(n - (9000 + 90));
			break;
		case 6:
			System.out.println(90000 + 900 + 9);
			break;
		}
	}
	
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sn = new Scanner(System.in);
		
		int n = sn.nextInt();
		int len = String.valueOf(n).length();
		
		switch (len) {
		case 1:
			System.out.println(n);
			break;
		case 2:
			System.out.println(9);
			break;
		case 3:
			System.out.println(n - 90);
			break;
		case 4:
			System.out.println(900 + 9);
			break;
		case 5:
			System.out.println(n - (9000 + 90));
			break;
		case 6:
			System.out.println(90000 + 900 + 9);
			break;
		}
	}
	
} Main public static void main(String[] args) throws IOException {
		Scanner sn = new Scanner(System.in);
		
		int n = sn.nextInt();
		int len = String.valueOf(n).length();
		
		switch (len) {
		case 1:
			System.out.println(n);
			break;
		case 2:
			System.out.println(9);
			break;
		case 3:
			System.out.println(n - 90);
			break;
		case 4:
			System.out.println(900 + 9);
			break;
		case 5:
			System.out.println(n - (9000 + 90));
			break;
		case 6:
			System.out.println(90000 + 900 + 9);
			break;
		}
	} main {
		Scanner sn = new Scanner(System.in);
		
		int n = sn.nextInt();
		int len = String.valueOf(n).length();
		
		switch (len) {
		case 1:
			System.out.println(n);
			break;
		case 2:
			System.out.println(9);
			break;
		case 3:
			System.out.println(n - 90);
			break;
		case 4:
			System.out.println(900 + 9);
			break;
		case 5:
			System.out.println(n - (9000 + 90));
			break;
		case 6:
			System.out.println(90000 + 900 + 9);
			break;
		}
	} Scanner sn = new Scanner(System.in); sn new Scanner(System.in) int n = sn.nextInt(); n sn.nextInt() sn.nextInt sn int len = String.valueOf(n).length(); len String.valueOf(n).length() String.valueOf(n).length String.valueOf(n) String.valueOf String n switch (len) {
		case 1:
			System.out.println(n);
			break;
		case 2:
			System.out.println(9);
			break;
		case 3:
			System.out.println(n - 90);
			break;
		case 4:
			System.out.println(900 + 9);
			break;
		case 5:
			System.out.println(n - (9000 + 90));
			break;
		case 6:
			System.out.println(90000 + 900 + 9);
			break;
		} len case 1: 1 case 1: System.out.println(n) System.out.println System.out System System.out n break; case 2: 2 case 2: System.out.println(9) System.out.println System.out System System.out 9 break; case 3: 3 case 3: System.out.println(n - 90) System.out.println System.out System System.out n - 90 n 90 break; case 4: 4 case 4: System.out.println(900 + 9) System.out.println System.out System System.out 900 + 9 900 9 break; case 5: 5 case 5: System.out.println(n - (9000 + 90)) System.out.println System.out System System.out n - (9000 + 90) n (9000 + 90) 9000 90 break; case 6: 6 case 6: System.out.println(90000 + 900 + 9) System.out.println System.out System System.out 90000 + 900 + 9 90000 + 900 + 9 90000 900 9 break; String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sn = new Scanner(System.in);
		
		int n = sn.nextInt();
		int len = String.valueOf(n).length();
		
		switch (len) {
		case 1:
			System.out.println(n);
			break;
		case 2:
			System.out.println(9);
			break;
		case 3:
			System.out.println(n - 90);
			break;
		case 4:
			System.out.println(900 + 9);
			break;
		case 5:
			System.out.println(n - (9000 + 90));
			break;
		case 6:
			System.out.println(90000 + 900 + 9);
			break;
		}
	}
	
} public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sn = new Scanner(System.in);
		
		int n = sn.nextInt();
		int len = String.valueOf(n).length();
		
		switch (len) {
		case 1:
			System.out.println(n);
			break;
		case 2:
			System.out.println(9);
			break;
		case 3:
			System.out.println(n - 90);
			break;
		case 4:
			System.out.println(900 + 9);
			break;
		case 5:
			System.out.println(n - (9000 + 90));
			break;
		case 6:
			System.out.println(90000 + 900 + 9);
			break;
		}
	}
	
} Main
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sn = new Scanner(System.in);
		
		int n = sn.nextInt();
		int len = String.valueOf(n).length();
		
		switch (len) {
		case 1:
			System.out.println(n);
			break;
		case 2:
			System.out.println(9);
			break;
		case 3:
			System.out.println(n - 90);
			break;
		case 4:
			System.out.println(900 + 9);
			break;
		case 5:
			System.out.println(n - (9000 + 90));
			break;
		case 6:
			System.out.println(90000 + 900 + 9);
			break;
		}
	}
	
}
