import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		String n = sc.next();
		int ans = 0;
		switch(n.length()) {
		case 1:
			ans = Integer.parseInt(n);
			break;
		case 2:
			ans = 9;
			break;
		case 3:
			ans = 9 + Integer.parseInt(n) - 99;
			break;
		case 4:
			ans = 9 + 900;
			break;
		case 5:
			ans = 9 + 900 + Integer.parseInt(n) - 9999;
			break;
		case 6:
			ans = 9 + 900 + 90000;
			break;
		}
		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);
		StringBuilder sb = new StringBuilder();
		String n = sc.next();
		int ans = 0;
		switch(n.length()) {
		case 1:
			ans = Integer.parseInt(n);
			break;
		case 2:
			ans = 9;
			break;
		case 3:
			ans = 9 + Integer.parseInt(n) - 99;
			break;
		case 4:
			ans = 9 + 900;
			break;
		case 5:
			ans = 9 + 900 + Integer.parseInt(n) - 9999;
			break;
		case 6:
			ans = 9 + 900 + 90000;
			break;
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		String n = sc.next();
		int ans = 0;
		switch(n.length()) {
		case 1:
			ans = Integer.parseInt(n);
			break;
		case 2:
			ans = 9;
			break;
		case 3:
			ans = 9 + Integer.parseInt(n) - 99;
			break;
		case 4:
			ans = 9 + 900;
			break;
		case 5:
			ans = 9 + 900 + Integer.parseInt(n) - 9999;
			break;
		case 6:
			ans = 9 + 900 + 90000;
			break;
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		String n = sc.next();
		int ans = 0;
		switch(n.length()) {
		case 1:
			ans = Integer.parseInt(n);
			break;
		case 2:
			ans = 9;
			break;
		case 3:
			ans = 9 + Integer.parseInt(n) - 99;
			break;
		case 4:
			ans = 9 + 900;
			break;
		case 5:
			ans = 9 + 900 + Integer.parseInt(n) - 9999;
			break;
		case 6:
			ans = 9 + 900 + 90000;
			break;
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder sb = new StringBuilder(); sb new StringBuilder() String n = sc.next(); n sc.next() sc.next sc int ans = 0; ans 0 switch(n.length()) {
		case 1:
			ans = Integer.parseInt(n);
			break;
		case 2:
			ans = 9;
			break;
		case 3:
			ans = 9 + Integer.parseInt(n) - 99;
			break;
		case 4:
			ans = 9 + 900;
			break;
		case 5:
			ans = 9 + 900 + Integer.parseInt(n) - 9999;
			break;
		case 6:
			ans = 9 + 900 + 90000;
			break;
		} n.length() n.length n case 1: 1 case 1: ans = Integer.parseInt(n) ans Integer.parseInt(n) Integer.parseInt Integer n break; case 2: 2 case 2: ans = 9 ans 9 break; case 3: 3 case 3: ans = 9 + Integer.parseInt(n) - 99 ans 9 + Integer.parseInt(n) - 99 9 + Integer.parseInt(n) 9 Integer.parseInt(n) Integer.parseInt Integer n 99 break; case 4: 4 case 4: ans = 9 + 900 ans 9 + 900 9 900 break; case 5: 5 case 5: ans = 9 + 900 + Integer.parseInt(n) - 9999 ans 9 + 900 + Integer.parseInt(n) - 9999 9 + 900 + Integer.parseInt(n) 9 + 900 + Integer.parseInt(n) 9 900 Integer.parseInt(n) Integer.parseInt Integer n 9999 break; case 6: 6 case 6: ans = 9 + 900 + 90000 ans 9 + 900 + 90000 9 + 900 + 90000 9 900 90000 break; 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);
		StringBuilder sb = new StringBuilder();
		String n = sc.next();
		int ans = 0;
		switch(n.length()) {
		case 1:
			ans = Integer.parseInt(n);
			break;
		case 2:
			ans = 9;
			break;
		case 3:
			ans = 9 + Integer.parseInt(n) - 99;
			break;
		case 4:
			ans = 9 + 900;
			break;
		case 5:
			ans = 9 + 900 + Integer.parseInt(n) - 9999;
			break;
		case 6:
			ans = 9 + 900 + 90000;
			break;
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		String n = sc.next();
		int ans = 0;
		switch(n.length()) {
		case 1:
			ans = Integer.parseInt(n);
			break;
		case 2:
			ans = 9;
			break;
		case 3:
			ans = 9 + Integer.parseInt(n) - 99;
			break;
		case 4:
			ans = 9 + 900;
			break;
		case 5:
			ans = 9 + 900 + Integer.parseInt(n) - 9999;
			break;
		case 6:
			ans = 9 + 900 + 90000;
			break;
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		String n = sc.next();
		int ans = 0;
		switch(n.length()) {
		case 1:
			ans = Integer.parseInt(n);
			break;
		case 2:
			ans = 9;
			break;
		case 3:
			ans = 9 + Integer.parseInt(n) - 99;
			break;
		case 4:
			ans = 9 + 900;
			break;
		case 5:
			ans = 9 + 900 + Integer.parseInt(n) - 9999;
			break;
		case 6:
			ans = 9 + 900 + 90000;
			break;
		}
		System.out.println(ans);
	}
}