import java.util.Scanner;

public class Main {

	private void solve() {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		
		int ans  = 0;
		boolean odd = true;
		int wall = 10;
		while(wall<=N) {
			if(odd) {
				ans += wall - wall/10;
			}
			odd = !odd;
			wall *= 10;
		}
		if(odd) ans += N - wall/10 + 1;
		System.out.println(ans);	
	}
	
	public static void main(String[] args) {
		new Main().solve();
	}
}
 import java.util.Scanner; Scanner java.util public class Main {

	private void solve() {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		
		int ans  = 0;
		boolean odd = true;
		int wall = 10;
		while(wall<=N) {
			if(odd) {
				ans += wall - wall/10;
			}
			odd = !odd;
			wall *= 10;
		}
		if(odd) ans += N - wall/10 + 1;
		System.out.println(ans);	
	}
	
	public static void main(String[] args) {
		new Main().solve();
	}
} Main private void solve() {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		
		int ans  = 0;
		boolean odd = true;
		int wall = 10;
		while(wall<=N) {
			if(odd) {
				ans += wall - wall/10;
			}
			odd = !odd;
			wall *= 10;
		}
		if(odd) ans += N - wall/10 + 1;
		System.out.println(ans);	
	} solve {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		
		int ans  = 0;
		boolean odd = true;
		int wall = 10;
		while(wall<=N) {
			if(odd) {
				ans += wall - wall/10;
			}
			odd = !odd;
			wall *= 10;
		}
		if(odd) ans += N - wall/10 + 1;
		System.out.println(ans);	
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int N = in.nextInt(); N in.nextInt() in.nextInt in int ans  = 0; ans 0 boolean odd = true; odd true int wall = 10; wall 10 while(wall<=N) {
			if(odd) {
				ans += wall - wall/10;
			}
			odd = !odd;
			wall *= 10;
		} wall<=N wall N {
			if(odd) {
				ans += wall - wall/10;
			}
			odd = !odd;
			wall *= 10;
		} if(odd) {
				ans += wall - wall/10;
			} odd {
				ans += wall - wall/10;
			} ans += wall - wall/10 ans wall - wall/10 wall wall/10 wall 10 odd = !odd odd !odd odd wall *= 10 wall 10 if(odd) ans += N - wall/10 + 1; odd ans += N - wall/10 + 1 ans N - wall/10 + 1 N - wall/10 N wall/10 wall 10 1 System.out.println(ans) System.out.println System.out System System.out ans public static void main(String[] args) {
		new Main().solve();
	} main {
		new Main().solve();
	} new Main().solve() new Main().solve new Main() String[] args args public class Main {

	private void solve() {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		
		int ans  = 0;
		boolean odd = true;
		int wall = 10;
		while(wall<=N) {
			if(odd) {
				ans += wall - wall/10;
			}
			odd = !odd;
			wall *= 10;
		}
		if(odd) ans += N - wall/10 + 1;
		System.out.println(ans);	
	}
	
	public static void main(String[] args) {
		new Main().solve();
	}
} public class Main {

	private void solve() {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		
		int ans  = 0;
		boolean odd = true;
		int wall = 10;
		while(wall<=N) {
			if(odd) {
				ans += wall - wall/10;
			}
			odd = !odd;
			wall *= 10;
		}
		if(odd) ans += N - wall/10 + 1;
		System.out.println(ans);	
	}
	
	public static void main(String[] args) {
		new Main().solve();
	}
} Main
import java.util.Scanner;

public class Main {

	private void solve() {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		
		int ans  = 0;
		boolean odd = true;
		int wall = 10;
		while(wall<=N) {
			if(odd) {
				ans += wall - wall/10;
			}
			odd = !odd;
			wall *= 10;
		}
		if(odd) ans += N - wall/10 + 1;
		System.out.println(ans);	
	}
	
	public static void main(String[] args) {
		new Main().solve();
	}
}

