import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	int counter = 0;
	if(N<10) {counter = N;}
	else if (N <100) {counter = 9;}
	else if (N <1000) {counter = 9+N-100+1;}
	else if (N <10000) {counter = 9+999-100+1;}
	else if (N<100000) {counter = 9+999-100+1+N-10000+1;}
	else {counter = 9+999-100+1+99999-10000+1;}
	
	
	System.out.println(counter);
	}
} 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();
	int counter = 0;
	if(N<10) {counter = N;}
	else if (N <100) {counter = 9;}
	else if (N <1000) {counter = 9+N-100+1;}
	else if (N <10000) {counter = 9+999-100+1;}
	else if (N<100000) {counter = 9+999-100+1+N-10000+1;}
	else {counter = 9+999-100+1+99999-10000+1;}
	
	
	System.out.println(counter);
	}
} Main public static void main(String[] args) {
		
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	int counter = 0;
	if(N<10) {counter = N;}
	else if (N <100) {counter = 9;}
	else if (N <1000) {counter = 9+N-100+1;}
	else if (N <10000) {counter = 9+999-100+1;}
	else if (N<100000) {counter = 9+999-100+1+N-10000+1;}
	else {counter = 9+999-100+1+99999-10000+1;}
	
	
	System.out.println(counter);
	} main {
		
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	int counter = 0;
	if(N<10) {counter = N;}
	else if (N <100) {counter = 9;}
	else if (N <1000) {counter = 9+N-100+1;}
	else if (N <10000) {counter = 9+999-100+1;}
	else if (N<100000) {counter = 9+999-100+1+N-10000+1;}
	else {counter = 9+999-100+1+99999-10000+1;}
	
	
	System.out.println(counter);
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int N = s.nextInt(); N s.nextInt() s.nextInt s int counter = 0; counter 0 if(N<10) {counter = N;}
	else if (N <100) {counter = 9;}
	else if (N <1000) {counter = 9+N-100+1;}
	else if (N <10000) {counter = 9+999-100+1;}
	else if (N<100000) {counter = 9+999-100+1+N-10000+1;}
	else {counter = 9+999-100+1+99999-10000+1;} N<10 N 10 {counter = N;} counter = N counter N if (N <100) {counter = 9;}
	else if (N <1000) {counter = 9+N-100+1;}
	else if (N <10000) {counter = 9+999-100+1;}
	else if (N<100000) {counter = 9+999-100+1+N-10000+1;}
	else {counter = 9+999-100+1+99999-10000+1;} N <100 N 100 {counter = 9;} counter = 9 counter 9 if (N <1000) {counter = 9+N-100+1;}
	else if (N <10000) {counter = 9+999-100+1;}
	else if (N<100000) {counter = 9+999-100+1+N-10000+1;}
	else {counter = 9+999-100+1+99999-10000+1;} N <1000 N 1000 {counter = 9+N-100+1;} counter = 9+N-100+1 counter 9+N-100+1 9+N-100 9+N 9 N 100 1 if (N <10000) {counter = 9+999-100+1;}
	else if (N<100000) {counter = 9+999-100+1+N-10000+1;}
	else {counter = 9+999-100+1+99999-10000+1;} N <10000 N 10000 {counter = 9+999-100+1;} counter = 9+999-100+1 counter 9+999-100+1 9+999-100 9+999 9 999 100 1 if (N<100000) {counter = 9+999-100+1+N-10000+1;}
	else {counter = 9+999-100+1+99999-10000+1;} N<100000 N 100000 {counter = 9+999-100+1+N-10000+1;} counter = 9+999-100+1+N-10000+1 counter 9+999-100+1+N-10000+1 9+999-100+1+N-10000 9+999-100+1+N 9+999-100+1+N 9+999-100 9+999 9 999 100 1 N 10000 1 {counter = 9+999-100+1+99999-10000+1;} counter = 9+999-100+1+99999-10000+1 counter 9+999-100+1+99999-10000+1 9+999-100+1+99999-10000 9+999-100+1+99999 9+999-100+1+99999 9+999-100 9+999 9 999 100 1 99999 10000 1 System.out.println(counter) System.out.println System.out System System.out counter String[] args args public class Main {
	public static void main(String[] args) {
		
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	int counter = 0;
	if(N<10) {counter = N;}
	else if (N <100) {counter = 9;}
	else if (N <1000) {counter = 9+N-100+1;}
	else if (N <10000) {counter = 9+999-100+1;}
	else if (N<100000) {counter = 9+999-100+1+N-10000+1;}
	else {counter = 9+999-100+1+99999-10000+1;}
	
	
	System.out.println(counter);
	}
} public class Main {
	public static void main(String[] args) {
		
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	int counter = 0;
	if(N<10) {counter = N;}
	else if (N <100) {counter = 9;}
	else if (N <1000) {counter = 9+N-100+1;}
	else if (N <10000) {counter = 9+999-100+1;}
	else if (N<100000) {counter = 9+999-100+1+N-10000+1;}
	else {counter = 9+999-100+1+99999-10000+1;}
	
	
	System.out.println(counter);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	int counter = 0;
	if(N<10) {counter = N;}
	else if (N <100) {counter = 9;}
	else if (N <1000) {counter = 9+N-100+1;}
	else if (N <10000) {counter = 9+999-100+1;}
	else if (N<100000) {counter = 9+999-100+1+N-10000+1;}
	else {counter = 9+999-100+1+99999-10000+1;}
	
	
	System.out.println(counter);
	}
}
