import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.nextLine());
        int keta = getRigidNum(N);
        int result = 0;
        for (int i = 1; i < keta+1; i++) {
        	if (i % 2 == 1 && i < keta) {
        		result += (nijyou(10, i) - 1) - nijyou(10, i-1) + 1;
        	}else if (i % 2 == 1 && i == keta) {
        		result += N - nijyou(10, i-1) + 1;
        	}
        }


        System.out.println(result);
    }

    private static int getRigidNum(int n) {
    	int i = 1;
    	while (n / nijyou(10, i) > 0) {
    		i++;
    	}
    	return i;
    }

    private static int nijyou(int n, int i) {
    	if (i == 0) {
    		return 1;
    	}
    	else if (i == 1) {
    		return n;
    	}else {
        	return n*nijyou(n, i - 1);
    	}

    }



} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.nextLine());
        int keta = getRigidNum(N);
        int result = 0;
        for (int i = 1; i < keta+1; i++) {
        	if (i % 2 == 1 && i < keta) {
        		result += (nijyou(10, i) - 1) - nijyou(10, i-1) + 1;
        	}else if (i % 2 == 1 && i == keta) {
        		result += N - nijyou(10, i-1) + 1;
        	}
        }


        System.out.println(result);
    }

    private static int getRigidNum(int n) {
    	int i = 1;
    	while (n / nijyou(10, i) > 0) {
    		i++;
    	}
    	return i;
    }

    private static int nijyou(int n, int i) {
    	if (i == 0) {
    		return 1;
    	}
    	else if (i == 1) {
    		return n;
    	}else {
        	return n*nijyou(n, i - 1);
    	}

    }



} Main public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.nextLine());
        int keta = getRigidNum(N);
        int result = 0;
        for (int i = 1; i < keta+1; i++) {
        	if (i % 2 == 1 && i < keta) {
        		result += (nijyou(10, i) - 1) - nijyou(10, i-1) + 1;
        	}else if (i % 2 == 1 && i == keta) {
        		result += N - nijyou(10, i-1) + 1;
        	}
        }


        System.out.println(result);
    } main {
    	Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.nextLine());
        int keta = getRigidNum(N);
        int result = 0;
        for (int i = 1; i < keta+1; i++) {
        	if (i % 2 == 1 && i < keta) {
        		result += (nijyou(10, i) - 1) - nijyou(10, i-1) + 1;
        	}else if (i % 2 == 1 && i == keta) {
        		result += N - nijyou(10, i-1) + 1;
        	}
        }


        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.nextLine()); N Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int keta = getRigidNum(N); keta getRigidNum(N) getRigidNum N int result = 0; result 0 for (int i = 1; i < keta+1; i++) {
        	if (i % 2 == 1 && i < keta) {
        		result += (nijyou(10, i) - 1) - nijyou(10, i-1) + 1;
        	}else if (i % 2 == 1 && i == keta) {
        		result += N - nijyou(10, i-1) + 1;
        	}
        } int i = 1; int i = 1; i 1 i < keta+1 i keta+1 keta 1 i++ i++ i {
        	if (i % 2 == 1 && i < keta) {
        		result += (nijyou(10, i) - 1) - nijyou(10, i-1) + 1;
        	}else if (i % 2 == 1 && i == keta) {
        		result += N - nijyou(10, i-1) + 1;
        	}
        } {
        	if (i % 2 == 1 && i < keta) {
        		result += (nijyou(10, i) - 1) - nijyou(10, i-1) + 1;
        	}else if (i % 2 == 1 && i == keta) {
        		result += N - nijyou(10, i-1) + 1;
        	}
        } if (i % 2 == 1 && i < keta) {
        		result += (nijyou(10, i) - 1) - nijyou(10, i-1) + 1;
        	}else if (i % 2 == 1 && i == keta) {
        		result += N - nijyou(10, i-1) + 1;
        	} i % 2 == 1 && i < keta i % 2 == 1 i % 2 i 2 1 i < keta i keta {
        		result += (nijyou(10, i) - 1) - nijyou(10, i-1) + 1;
        	} result += (nijyou(10, i) - 1) - nijyou(10, i-1) + 1 result (nijyou(10, i) - 1) - nijyou(10, i-1) + 1 (nijyou(10, i) - 1) - nijyou(10, i-1) (nijyou(10, i) - 1) nijyou(10, i) nijyou 10 i 1 nijyou(10, i-1) nijyou 10 i-1 i 1 1 if (i % 2 == 1 && i == keta) {
        		result += N - nijyou(10, i-1) + 1;
        	} i % 2 == 1 && i == keta i % 2 == 1 i % 2 i 2 1 i == keta i keta {
        		result += N - nijyou(10, i-1) + 1;
        	} result += N - nijyou(10, i-1) + 1 result N - nijyou(10, i-1) + 1 N - nijyou(10, i-1) N nijyou(10, i-1) nijyou 10 i-1 i 1 1 System.out.println(result) System.out.println System.out System System.out result String[] args args private static int getRigidNum(int n) {
    	int i = 1;
    	while (n / nijyou(10, i) > 0) {
    		i++;
    	}
    	return i;
    } getRigidNum {
    	int i = 1;
    	while (n / nijyou(10, i) > 0) {
    		i++;
    	}
    	return i;
    } int i = 1; i 1 while (n / nijyou(10, i) > 0) {
    		i++;
    	} n / nijyou(10, i) > 0 n / nijyou(10, i) n nijyou(10, i) nijyou 10 i 0 {
    		i++;
    	} i++ i return i; i int n n private static int nijyou(int n, int i) {
    	if (i == 0) {
    		return 1;
    	}
    	else if (i == 1) {
    		return n;
    	}else {
        	return n*nijyou(n, i - 1);
    	}

    } nijyou {
    	if (i == 0) {
    		return 1;
    	}
    	else if (i == 1) {
    		return n;
    	}else {
        	return n*nijyou(n, i - 1);
    	}

    } if (i == 0) {
    		return 1;
    	}
    	else if (i == 1) {
    		return n;
    	}else {
        	return n*nijyou(n, i - 1);
    	} i == 0 i 0 {
    		return 1;
    	} return 1; 1 if (i == 1) {
    		return n;
    	}else {
        	return n*nijyou(n, i - 1);
    	} i == 1 i 1 {
    		return n;
    	} return n; n {
        	return n*nijyou(n, i - 1);
    	} return n*nijyou(n, i - 1); n*nijyou(n, i - 1) n nijyou(n, i - 1) nijyou n i - 1 i 1 int n n int i i public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.nextLine());
        int keta = getRigidNum(N);
        int result = 0;
        for (int i = 1; i < keta+1; i++) {
        	if (i % 2 == 1 && i < keta) {
        		result += (nijyou(10, i) - 1) - nijyou(10, i-1) + 1;
        	}else if (i % 2 == 1 && i == keta) {
        		result += N - nijyou(10, i-1) + 1;
        	}
        }


        System.out.println(result);
    }

    private static int getRigidNum(int n) {
    	int i = 1;
    	while (n / nijyou(10, i) > 0) {
    		i++;
    	}
    	return i;
    }

    private static int nijyou(int n, int i) {
    	if (i == 0) {
    		return 1;
    	}
    	else if (i == 1) {
    		return n;
    	}else {
        	return n*nijyou(n, i - 1);
    	}

    }



} public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.nextLine());
        int keta = getRigidNum(N);
        int result = 0;
        for (int i = 1; i < keta+1; i++) {
        	if (i % 2 == 1 && i < keta) {
        		result += (nijyou(10, i) - 1) - nijyou(10, i-1) + 1;
        	}else if (i % 2 == 1 && i == keta) {
        		result += N - nijyou(10, i-1) + 1;
        	}
        }


        System.out.println(result);
    }

    private static int getRigidNum(int n) {
    	int i = 1;
    	while (n / nijyou(10, i) > 0) {
    		i++;
    	}
    	return i;
    }

    private static int nijyou(int n, int i) {
    	if (i == 0) {
    		return 1;
    	}
    	else if (i == 1) {
    		return n;
    	}else {
        	return n*nijyou(n, i - 1);
    	}

    }



} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.nextLine());
        int keta = getRigidNum(N);
        int result = 0;
        for (int i = 1; i < keta+1; i++) {
        	if (i % 2 == 1 && i < keta) {
        		result += (nijyou(10, i) - 1) - nijyou(10, i-1) + 1;
        	}else if (i % 2 == 1 && i == keta) {
        		result += N - nijyou(10, i-1) + 1;
        	}
        }


        System.out.println(result);
    }

    private static int getRigidNum(int n) {
    	int i = 1;
    	while (n / nijyou(10, i) > 0) {
    		i++;
    	}
    	return i;
    }

    private static int nijyou(int n, int i) {
    	if (i == 0) {
    		return 1;
    	}
    	else if (i == 1) {
    		return n;
    	}else {
        	return n*nijyou(n, i - 1);
    	}

    }



}