import java.io.PrintWriter;
import java.util.*;

public class Main {
		public static void main(String[] args) {
			Scanner stdin = new Scanner(System.in);
			PrintWriter out = new PrintWriter(System.out);
			
			int N = Integer.parseInt(stdin.next());
			int cnt=0;
			
			for(int i=0;i<=N;i++) {
				if(i<=9999999 && i>=1000000) {
					cnt+=1;
				}
				else if(i<=99999 && i>=10000) {
					cnt+=1;
				}
				else if(i<=999 && i>=100) {
					cnt+=1;
				}
				else if(i<=9 && i>=1) {
					cnt+=1;
				}
			}
			out.println(cnt);
			
			out.flush();
	}
}

 import java.io.PrintWriter; PrintWriter java.io import java.util.*; util.* java public class Main {
		public static void main(String[] args) {
			Scanner stdin = new Scanner(System.in);
			PrintWriter out = new PrintWriter(System.out);
			
			int N = Integer.parseInt(stdin.next());
			int cnt=0;
			
			for(int i=0;i<=N;i++) {
				if(i<=9999999 && i>=1000000) {
					cnt+=1;
				}
				else if(i<=99999 && i>=10000) {
					cnt+=1;
				}
				else if(i<=999 && i>=100) {
					cnt+=1;
				}
				else if(i<=9 && i>=1) {
					cnt+=1;
				}
			}
			out.println(cnt);
			
			out.flush();
	}
} Main public static void main(String[] args) {
			Scanner stdin = new Scanner(System.in);
			PrintWriter out = new PrintWriter(System.out);
			
			int N = Integer.parseInt(stdin.next());
			int cnt=0;
			
			for(int i=0;i<=N;i++) {
				if(i<=9999999 && i>=1000000) {
					cnt+=1;
				}
				else if(i<=99999 && i>=10000) {
					cnt+=1;
				}
				else if(i<=999 && i>=100) {
					cnt+=1;
				}
				else if(i<=9 && i>=1) {
					cnt+=1;
				}
			}
			out.println(cnt);
			
			out.flush();
	} main {
			Scanner stdin = new Scanner(System.in);
			PrintWriter out = new PrintWriter(System.out);
			
			int N = Integer.parseInt(stdin.next());
			int cnt=0;
			
			for(int i=0;i<=N;i++) {
				if(i<=9999999 && i>=1000000) {
					cnt+=1;
				}
				else if(i<=99999 && i>=10000) {
					cnt+=1;
				}
				else if(i<=999 && i>=100) {
					cnt+=1;
				}
				else if(i<=9 && i>=1) {
					cnt+=1;
				}
			}
			out.println(cnt);
			
			out.flush();
	} Scanner stdin = new Scanner(System.in); stdin new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int N = Integer.parseInt(stdin.next()); N Integer.parseInt(stdin.next()) Integer.parseInt Integer stdin.next() stdin.next stdin int cnt=0; cnt 0 for(int i=0;i<=N;i++) {
				if(i<=9999999 && i>=1000000) {
					cnt+=1;
				}
				else if(i<=99999 && i>=10000) {
					cnt+=1;
				}
				else if(i<=999 && i>=100) {
					cnt+=1;
				}
				else if(i<=9 && i>=1) {
					cnt+=1;
				}
			} int i=0; int i=0; i 0 i<=N i N i++ i++ i {
				if(i<=9999999 && i>=1000000) {
					cnt+=1;
				}
				else if(i<=99999 && i>=10000) {
					cnt+=1;
				}
				else if(i<=999 && i>=100) {
					cnt+=1;
				}
				else if(i<=9 && i>=1) {
					cnt+=1;
				}
			} {
				if(i<=9999999 && i>=1000000) {
					cnt+=1;
				}
				else if(i<=99999 && i>=10000) {
					cnt+=1;
				}
				else if(i<=999 && i>=100) {
					cnt+=1;
				}
				else if(i<=9 && i>=1) {
					cnt+=1;
				}
			} if(i<=9999999 && i>=1000000) {
					cnt+=1;
				}
				else if(i<=99999 && i>=10000) {
					cnt+=1;
				}
				else if(i<=999 && i>=100) {
					cnt+=1;
				}
				else if(i<=9 && i>=1) {
					cnt+=1;
				} i<=9999999 && i>=1000000 i<=9999999 i 9999999 i>=1000000 i 1000000 {
					cnt+=1;
				} cnt+=1 cnt 1 if(i<=99999 && i>=10000) {
					cnt+=1;
				}
				else if(i<=999 && i>=100) {
					cnt+=1;
				}
				else if(i<=9 && i>=1) {
					cnt+=1;
				} i<=99999 && i>=10000 i<=99999 i 99999 i>=10000 i 10000 {
					cnt+=1;
				} cnt+=1 cnt 1 if(i<=999 && i>=100) {
					cnt+=1;
				}
				else if(i<=9 && i>=1) {
					cnt+=1;
				} i<=999 && i>=100 i<=999 i 999 i>=100 i 100 {
					cnt+=1;
				} cnt+=1 cnt 1 if(i<=9 && i>=1) {
					cnt+=1;
				} i<=9 && i>=1 i<=9 i 9 i>=1 i 1 {
					cnt+=1;
				} cnt+=1 cnt 1 out.println(cnt) out.println out cnt out.flush() out.flush out String[] args args public class Main {
		public static void main(String[] args) {
			Scanner stdin = new Scanner(System.in);
			PrintWriter out = new PrintWriter(System.out);
			
			int N = Integer.parseInt(stdin.next());
			int cnt=0;
			
			for(int i=0;i<=N;i++) {
				if(i<=9999999 && i>=1000000) {
					cnt+=1;
				}
				else if(i<=99999 && i>=10000) {
					cnt+=1;
				}
				else if(i<=999 && i>=100) {
					cnt+=1;
				}
				else if(i<=9 && i>=1) {
					cnt+=1;
				}
			}
			out.println(cnt);
			
			out.flush();
	}
} public class Main {
		public static void main(String[] args) {
			Scanner stdin = new Scanner(System.in);
			PrintWriter out = new PrintWriter(System.out);
			
			int N = Integer.parseInt(stdin.next());
			int cnt=0;
			
			for(int i=0;i<=N;i++) {
				if(i<=9999999 && i>=1000000) {
					cnt+=1;
				}
				else if(i<=99999 && i>=10000) {
					cnt+=1;
				}
				else if(i<=999 && i>=100) {
					cnt+=1;
				}
				else if(i<=9 && i>=1) {
					cnt+=1;
				}
			}
			out.println(cnt);
			
			out.flush();
	}
} Main
import java.io.PrintWriter;
import java.util.*;

public class Main {
		public static void main(String[] args) {
			Scanner stdin = new Scanner(System.in);
			PrintWriter out = new PrintWriter(System.out);
			
			int N = Integer.parseInt(stdin.next());
			int cnt=0;
			
			for(int i=0;i<=N;i++) {
				if(i<=9999999 && i>=1000000) {
					cnt+=1;
				}
				else if(i<=99999 && i>=10000) {
					cnt+=1;
				}
				else if(i<=999 && i>=100) {
					cnt+=1;
				}
				else if(i<=9 && i>=1) {
					cnt+=1;
				}
			}
			out.println(cnt);
			
			out.flush();
	}
}


