
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();//1 ~ 10^5 = 100000

		int count = 0;
		int N1000 = 90;//Nが999までなら
		int N10000 = 9090;//Nが9999までなら
		int N100000 = 9091;//Nが100000なら

		if(N < 10) {//1 ~ 9
			count = N;
		}else if(N < 100) {//10 ~ 99 = 90個
			count = 9;
		}else if(N < 1000) {//100 ~ 999
			count = N - N1000;
		}else if(N < 10000) {//1000 ~ 9999 = 9000個
			count = 909;
		}else if(N < 100000){//10000 ~ 99999
			count = N - N10000;
		}else {//100000 = 10^5
			count = 90909;
		}

		System.out.println(count);
	}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();//1 ~ 10^5 = 100000

		int count = 0;
		int N1000 = 90;//Nが999までなら
		int N10000 = 9090;//Nが9999までなら
		int N100000 = 9091;//Nが100000なら

		if(N < 10) {//1 ~ 9
			count = N;
		}else if(N < 100) {//10 ~ 99 = 90個
			count = 9;
		}else if(N < 1000) {//100 ~ 999
			count = N - N1000;
		}else if(N < 10000) {//1000 ~ 9999 = 9000個
			count = 909;
		}else if(N < 100000){//10000 ~ 99999
			count = N - N10000;
		}else {//100000 = 10^5
			count = 90909;
		}

		System.out.println(count);
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();//1 ~ 10^5 = 100000

		int count = 0;
		int N1000 = 90;//Nが999までなら
		int N10000 = 9090;//Nが9999までなら
		int N100000 = 9091;//Nが100000なら

		if(N < 10) {//1 ~ 9
			count = N;
		}else if(N < 100) {//10 ~ 99 = 90個
			count = 9;
		}else if(N < 1000) {//100 ~ 999
			count = N - N1000;
		}else if(N < 10000) {//1000 ~ 9999 = 9000個
			count = 909;
		}else if(N < 100000){//10000 ~ 99999
			count = N - N10000;
		}else {//100000 = 10^5
			count = 90909;
		}

		System.out.println(count);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();//1 ~ 10^5 = 100000

		int count = 0;
		int N1000 = 90;//Nが999までなら
		int N10000 = 9090;//Nが9999までなら
		int N100000 = 9091;//Nが100000なら

		if(N < 10) {//1 ~ 9
			count = N;
		}else if(N < 100) {//10 ~ 99 = 90個
			count = 9;
		}else if(N < 1000) {//100 ~ 999
			count = N - N1000;
		}else if(N < 10000) {//1000 ~ 9999 = 9000個
			count = 909;
		}else if(N < 100000){//10000 ~ 99999
			count = N - N10000;
		}else {//100000 = 10^5
			count = 90909;
		}

		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int count = 0; count 0 int N1000 = 90; N1000 90 int N10000 = 9090; N10000 9090 int N100000 = 9091; N100000 9091 if(N < 10) {//1 ~ 9
			count = N;
		}else if(N < 100) {//10 ~ 99 = 90個
			count = 9;
		}else if(N < 1000) {//100 ~ 999
			count = N - N1000;
		}else if(N < 10000) {//1000 ~ 9999 = 9000個
			count = 909;
		}else if(N < 100000){//10000 ~ 99999
			count = N - N10000;
		}else {//100000 = 10^5
			count = 90909;
		} N < 10 N 10 {//1 ~ 9
			count = N;
		} count = N count N if(N < 100) {//10 ~ 99 = 90個
			count = 9;
		}else if(N < 1000) {//100 ~ 999
			count = N - N1000;
		}else if(N < 10000) {//1000 ~ 9999 = 9000個
			count = 909;
		}else if(N < 100000){//10000 ~ 99999
			count = N - N10000;
		}else {//100000 = 10^5
			count = 90909;
		} N < 100 N 100 {//10 ~ 99 = 90個
			count = 9;
		} count = 9 count 9 if(N < 1000) {//100 ~ 999
			count = N - N1000;
		}else if(N < 10000) {//1000 ~ 9999 = 9000個
			count = 909;
		}else if(N < 100000){//10000 ~ 99999
			count = N - N10000;
		}else {//100000 = 10^5
			count = 90909;
		} N < 1000 N 1000 {//100 ~ 999
			count = N - N1000;
		} count = N - N1000 count N - N1000 N N1000 if(N < 10000) {//1000 ~ 9999 = 9000個
			count = 909;
		}else if(N < 100000){//10000 ~ 99999
			count = N - N10000;
		}else {//100000 = 10^5
			count = 90909;
		} N < 10000 N 10000 {//1000 ~ 9999 = 9000個
			count = 909;
		} count = 909 count 909 if(N < 100000){//10000 ~ 99999
			count = N - N10000;
		}else {//100000 = 10^5
			count = 90909;
		} N < 100000 N 100000 {//10000 ~ 99999
			count = N - N10000;
		} count = N - N10000 count N - N10000 N N10000 {//100000 = 10^5
			count = 90909;
		} count = 90909 count 90909 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();//1 ~ 10^5 = 100000

		int count = 0;
		int N1000 = 90;//Nが999までなら
		int N10000 = 9090;//Nが9999までなら
		int N100000 = 9091;//Nが100000なら

		if(N < 10) {//1 ~ 9
			count = N;
		}else if(N < 100) {//10 ~ 99 = 90個
			count = 9;
		}else if(N < 1000) {//100 ~ 999
			count = N - N1000;
		}else if(N < 10000) {//1000 ~ 9999 = 9000個
			count = 909;
		}else if(N < 100000){//10000 ~ 99999
			count = N - N10000;
		}else {//100000 = 10^5
			count = 90909;
		}

		System.out.println(count);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();//1 ~ 10^5 = 100000

		int count = 0;
		int N1000 = 90;//Nが999までなら
		int N10000 = 9090;//Nが9999までなら
		int N100000 = 9091;//Nが100000なら

		if(N < 10) {//1 ~ 9
			count = N;
		}else if(N < 100) {//10 ~ 99 = 90個
			count = 9;
		}else if(N < 1000) {//100 ~ 999
			count = N - N1000;
		}else if(N < 10000) {//1000 ~ 9999 = 9000個
			count = 909;
		}else if(N < 100000){//10000 ~ 99999
			count = N - N10000;
		}else {//100000 = 10^5
			count = 90909;
		}

		System.out.println(count);
	}

} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();//1 ~ 10^5 = 100000

		int count = 0;
		int N1000 = 90;//Nが999までなら
		int N10000 = 9090;//Nが9999までなら
		int N100000 = 9091;//Nが100000なら

		if(N < 10) {//1 ~ 9
			count = N;
		}else if(N < 100) {//10 ~ 99 = 90個
			count = 9;
		}else if(N < 1000) {//100 ~ 999
			count = N - N1000;
		}else if(N < 10000) {//1000 ~ 9999 = 9000個
			count = 909;
		}else if(N < 100000){//10000 ~ 99999
			count = N - N10000;
		}else {//100000 = 10^5
			count = 90909;
		}

		System.out.println(count);
	}

}
