import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int t = 0,count = 0;
		int b = a;
		while (b>0){
			b = b/10;
			t ++;
		}
		for (int i = 1; i < t; i+=2){
			if (i==1){
				count+=9;
			} else {
				int min=1,max=9,j=i;
				while (j>1){
					min*=10;
					max*=10;
					max+=9;
					j--;
				}
				count+=max-min;
				count++;
			}
		}
		if(t%2==1) {
			int min = 1,j = t;
			while (j>1){
				min*=10;
				j--;
			}
			count+=a-min;
			count++;
		}
		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);
		int a = sc.nextInt();
		int t = 0,count = 0;
		int b = a;
		while (b>0){
			b = b/10;
			t ++;
		}
		for (int i = 1; i < t; i+=2){
			if (i==1){
				count+=9;
			} else {
				int min=1,max=9,j=i;
				while (j>1){
					min*=10;
					max*=10;
					max+=9;
					j--;
				}
				count+=max-min;
				count++;
			}
		}
		if(t%2==1) {
			int min = 1,j = t;
			while (j>1){
				min*=10;
				j--;
			}
			count+=a-min;
			count++;
		}
		System.out.println(count);
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int t = 0,count = 0;
		int b = a;
		while (b>0){
			b = b/10;
			t ++;
		}
		for (int i = 1; i < t; i+=2){
			if (i==1){
				count+=9;
			} else {
				int min=1,max=9,j=i;
				while (j>1){
					min*=10;
					max*=10;
					max+=9;
					j--;
				}
				count+=max-min;
				count++;
			}
		}
		if(t%2==1) {
			int min = 1,j = t;
			while (j>1){
				min*=10;
				j--;
			}
			count+=a-min;
			count++;
		}
		System.out.println(count);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int t = 0,count = 0;
		int b = a;
		while (b>0){
			b = b/10;
			t ++;
		}
		for (int i = 1; i < t; i+=2){
			if (i==1){
				count+=9;
			} else {
				int min=1,max=9,j=i;
				while (j>1){
					min*=10;
					max*=10;
					max+=9;
					j--;
				}
				count+=max-min;
				count++;
			}
		}
		if(t%2==1) {
			int min = 1,j = t;
			while (j>1){
				min*=10;
				j--;
			}
			count+=a-min;
			count++;
		}
		System.out.println(count);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int t = 0 t 0 count = 0; count 0 int b = a; b a while (b>0){
			b = b/10;
			t ++;
		} b>0 b 0 {
			b = b/10;
			t ++;
		} b = b/10 b b/10 b 10 t ++ t for (int i = 1; i < t; i+=2){
			if (i==1){
				count+=9;
			} else {
				int min=1,max=9,j=i;
				while (j>1){
					min*=10;
					max*=10;
					max+=9;
					j--;
				}
				count+=max-min;
				count++;
			}
		} int i = 1; int i = 1; i 1 i < t i t i+=2 i+=2 i 2 {
			if (i==1){
				count+=9;
			} else {
				int min=1,max=9,j=i;
				while (j>1){
					min*=10;
					max*=10;
					max+=9;
					j--;
				}
				count+=max-min;
				count++;
			}
		} {
			if (i==1){
				count+=9;
			} else {
				int min=1,max=9,j=i;
				while (j>1){
					min*=10;
					max*=10;
					max+=9;
					j--;
				}
				count+=max-min;
				count++;
			}
		} if (i==1){
				count+=9;
			} else {
				int min=1,max=9,j=i;
				while (j>1){
					min*=10;
					max*=10;
					max+=9;
					j--;
				}
				count+=max-min;
				count++;
			} i==1 i 1 {
				count+=9;
			} count+=9 count 9 {
				int min=1,max=9,j=i;
				while (j>1){
					min*=10;
					max*=10;
					max+=9;
					j--;
				}
				count+=max-min;
				count++;
			} int min=1 min 1 max=9 max 9 j=i; j i while (j>1){
					min*=10;
					max*=10;
					max+=9;
					j--;
				} j>1 j 1 {
					min*=10;
					max*=10;
					max+=9;
					j--;
				} min*=10 min 10 max*=10 max 10 max+=9 max 9 j-- j count+=max-min count max-min max min count++ count if(t%2==1) {
			int min = 1,j = t;
			while (j>1){
				min*=10;
				j--;
			}
			count+=a-min;
			count++;
		} t%2==1 t%2 t 2 1 {
			int min = 1,j = t;
			while (j>1){
				min*=10;
				j--;
			}
			count+=a-min;
			count++;
		} int min = 1 min 1 j = t; j t while (j>1){
				min*=10;
				j--;
			} j>1 j 1 {
				min*=10;
				j--;
			} min*=10 min 10 j-- j count+=a-min count a-min a min count++ count 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);
		int a = sc.nextInt();
		int t = 0,count = 0;
		int b = a;
		while (b>0){
			b = b/10;
			t ++;
		}
		for (int i = 1; i < t; i+=2){
			if (i==1){
				count+=9;
			} else {
				int min=1,max=9,j=i;
				while (j>1){
					min*=10;
					max*=10;
					max+=9;
					j--;
				}
				count+=max-min;
				count++;
			}
		}
		if(t%2==1) {
			int min = 1,j = t;
			while (j>1){
				min*=10;
				j--;
			}
			count+=a-min;
			count++;
		}
		System.out.println(count);
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int t = 0,count = 0;
		int b = a;
		while (b>0){
			b = b/10;
			t ++;
		}
		for (int i = 1; i < t; i+=2){
			if (i==1){
				count+=9;
			} else {
				int min=1,max=9,j=i;
				while (j>1){
					min*=10;
					max*=10;
					max+=9;
					j--;
				}
				count+=max-min;
				count++;
			}
		}
		if(t%2==1) {
			int min = 1,j = t;
			while (j>1){
				min*=10;
				j--;
			}
			count+=a-min;
			count++;
		}
		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);
		int a = sc.nextInt();
		int t = 0,count = 0;
		int b = a;
		while (b>0){
			b = b/10;
			t ++;
		}
		for (int i = 1; i < t; i+=2){
			if (i==1){
				count+=9;
			} else {
				int min=1,max=9,j=i;
				while (j>1){
					min*=10;
					max*=10;
					max+=9;
					j--;
				}
				count+=max-min;
				count++;
			}
		}
		if(t%2==1) {
			int min = 1,j = t;
			while (j>1){
				min*=10;
				j--;
			}
			count+=a-min;
			count++;
		}
		System.out.println(count);
		sc.close();
	}
}