
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = 0;
		int i = 0;
		while(true) {
			int div = n / (int) Math.pow(10, i);
			int mod = n % (int) Math.pow(10, i);
			if(div >= 10) {
				ans += Math.pow(10, i) * 9;
			} else if(div > 0) {
				ans += (div - 1) * Math.pow(10, i);
				ans += mod + 1;
				break;
			} else {
				break;
			}
			i += 2;
		}
		System.out.println(ans);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = 0;
		int i = 0;
		while(true) {
			int div = n / (int) Math.pow(10, i);
			int mod = n % (int) Math.pow(10, i);
			if(div >= 10) {
				ans += Math.pow(10, i) * 9;
			} else if(div > 0) {
				ans += (div - 1) * Math.pow(10, i);
				ans += mod + 1;
				break;
			} else {
				break;
			}
			i += 2;
		}
		System.out.println(ans);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = 0;
		int i = 0;
		while(true) {
			int div = n / (int) Math.pow(10, i);
			int mod = n % (int) Math.pow(10, i);
			if(div >= 10) {
				ans += Math.pow(10, i) * 9;
			} else if(div > 0) {
				ans += (div - 1) * Math.pow(10, i);
				ans += mod + 1;
				break;
			} else {
				break;
			}
			i += 2;
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = 0;
		int i = 0;
		while(true) {
			int div = n / (int) Math.pow(10, i);
			int mod = n % (int) Math.pow(10, i);
			if(div >= 10) {
				ans += Math.pow(10, i) * 9;
			} else if(div > 0) {
				ans += (div - 1) * Math.pow(10, i);
				ans += mod + 1;
				break;
			} else {
				break;
			}
			i += 2;
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ans = 0; ans 0 int i = 0; i 0 while(true) {
			int div = n / (int) Math.pow(10, i);
			int mod = n % (int) Math.pow(10, i);
			if(div >= 10) {
				ans += Math.pow(10, i) * 9;
			} else if(div > 0) {
				ans += (div - 1) * Math.pow(10, i);
				ans += mod + 1;
				break;
			} else {
				break;
			}
			i += 2;
		} true {
			int div = n / (int) Math.pow(10, i);
			int mod = n % (int) Math.pow(10, i);
			if(div >= 10) {
				ans += Math.pow(10, i) * 9;
			} else if(div > 0) {
				ans += (div - 1) * Math.pow(10, i);
				ans += mod + 1;
				break;
			} else {
				break;
			}
			i += 2;
		} int div = n / (int) Math.pow(10, i); div n / (int) Math.pow(10, i) n (int) Math.pow(10, i) Math.pow Math 10 i int mod = n % (int) Math.pow(10, i); mod n % (int) Math.pow(10, i) n (int) Math.pow(10, i) Math.pow Math 10 i if(div >= 10) {
				ans += Math.pow(10, i) * 9;
			} else if(div > 0) {
				ans += (div - 1) * Math.pow(10, i);
				ans += mod + 1;
				break;
			} else {
				break;
			} div >= 10 div 10 {
				ans += Math.pow(10, i) * 9;
			} ans += Math.pow(10, i) * 9 ans Math.pow(10, i) * 9 Math.pow(10, i) Math.pow Math 10 i 9 if(div > 0) {
				ans += (div - 1) * Math.pow(10, i);
				ans += mod + 1;
				break;
			} else {
				break;
			} div > 0 div 0 {
				ans += (div - 1) * Math.pow(10, i);
				ans += mod + 1;
				break;
			} ans += (div - 1) * Math.pow(10, i) ans (div - 1) * Math.pow(10, i) (div - 1) div 1 Math.pow(10, i) Math.pow Math 10 i ans += mod + 1 ans mod + 1 mod 1 break; {
				break;
			} break; i += 2 i 2 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = 0;
		int i = 0;
		while(true) {
			int div = n / (int) Math.pow(10, i);
			int mod = n % (int) Math.pow(10, i);
			if(div >= 10) {
				ans += Math.pow(10, i) * 9;
			} else if(div > 0) {
				ans += (div - 1) * Math.pow(10, i);
				ans += mod + 1;
				break;
			} else {
				break;
			}
			i += 2;
		}
		System.out.println(ans);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = 0;
		int i = 0;
		while(true) {
			int div = n / (int) Math.pow(10, i);
			int mod = n % (int) Math.pow(10, i);
			if(div >= 10) {
				ans += Math.pow(10, i) * 9;
			} else if(div > 0) {
				ans += (div - 1) * Math.pow(10, i);
				ans += mod + 1;
				break;
			} else {
				break;
			}
			i += 2;
		}
		System.out.println(ans);
	}

} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = 0;
		int i = 0;
		while(true) {
			int div = n / (int) Math.pow(10, i);
			int mod = n % (int) Math.pow(10, i);
			if(div >= 10) {
				ans += Math.pow(10, i) * 9;
			} else if(div > 0) {
				ans += (div - 1) * Math.pow(10, i);
				ans += mod + 1;
				break;
			} else {
				break;
			}
			i += 2;
		}
		System.out.println(ans);
	}

}
