import java.util.Scanner;

/**
 * https://atcoder.jp/contests/abc136/tasks/abc136_b
 */
public class Main {

  private static int answer(int n) {
    int count = 0;
    count += Math.min(n, 9);
    if (n >= 100) {
      count += Math.min(n, 999) - 99;
    }
    if (n >= 10000) {
      count += Math.min(n, 99999) - 9999;
    }

    return count;
  }

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    scan.close();

    System.out.println(answer(n));
  }
} import java.util.Scanner; Scanner java.util public class Main {

  private static int answer(int n) {
    int count = 0;
    count += Math.min(n, 9);
    if (n >= 100) {
      count += Math.min(n, 999) - 99;
    }
    if (n >= 10000) {
      count += Math.min(n, 99999) - 9999;
    }

    return count;
  }

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    scan.close();

    System.out.println(answer(n));
  }
} Main private static int answer(int n) {
    int count = 0;
    count += Math.min(n, 9);
    if (n >= 100) {
      count += Math.min(n, 999) - 99;
    }
    if (n >= 10000) {
      count += Math.min(n, 99999) - 9999;
    }

    return count;
  } answer {
    int count = 0;
    count += Math.min(n, 9);
    if (n >= 100) {
      count += Math.min(n, 999) - 99;
    }
    if (n >= 10000) {
      count += Math.min(n, 99999) - 9999;
    }

    return count;
  } int count = 0; count 0 count += Math.min(n, 9) count Math.min(n, 9) Math.min Math n 9 if (n >= 100) {
      count += Math.min(n, 999) - 99;
    } n >= 100 n 100 {
      count += Math.min(n, 999) - 99;
    } count += Math.min(n, 999) - 99 count Math.min(n, 999) - 99 Math.min(n, 999) Math.min Math n 999 99 if (n >= 10000) {
      count += Math.min(n, 99999) - 9999;
    } n >= 10000 n 10000 {
      count += Math.min(n, 99999) - 9999;
    } count += Math.min(n, 99999) - 9999 count Math.min(n, 99999) - 9999 Math.min(n, 99999) Math.min Math n 99999 9999 return count; count int n n public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    scan.close();

    System.out.println(answer(n));
  } main {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    scan.close();

    System.out.println(answer(n));
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan scan.close() scan.close scan System.out.println(answer(n)) System.out.println System.out System System.out answer(n) answer n String[] args args public class Main {

  private static int answer(int n) {
    int count = 0;
    count += Math.min(n, 9);
    if (n >= 100) {
      count += Math.min(n, 999) - 99;
    }
    if (n >= 10000) {
      count += Math.min(n, 99999) - 9999;
    }

    return count;
  }

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    scan.close();

    System.out.println(answer(n));
  }
} public class Main {

  private static int answer(int n) {
    int count = 0;
    count += Math.min(n, 9);
    if (n >= 100) {
      count += Math.min(n, 999) - 99;
    }
    if (n >= 10000) {
      count += Math.min(n, 99999) - 9999;
    }

    return count;
  }

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    scan.close();

    System.out.println(answer(n));
  }
} Main
import java.util.Scanner;

/**
 * https://atcoder.jp/contests/abc136/tasks/abc136_b
 */
public class Main {

  private static int answer(int n) {
    int count = 0;
    count += Math.min(n, 9);
    if (n >= 100) {
      count += Math.min(n, 999) - 99;
    }
    if (n >= 10000) {
      count += Math.min(n, 99999) - 9999;
    }

    return count;
  }

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    scan.close();

    System.out.println(answer(n));
  }
}
