B - Uneven Numbers 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 200

問題文

整数 N が与えられます。N 以下の正の整数のうち、(先頭に 0 をつけずに十進法で表記したときの) 桁数が奇数であるようなものの個数を求めてください。

制約

  • 1 \leq N \leq 10^5

入力

入力は以下の形式で標準入力から与えられる。

N

出力

N 以下の正の整数のうち、桁数が奇数であるようなものの個数を出力せよ。


入力例 1

11

出力例 1

9

11 以下の正の整数のうち、桁数が奇数であるようなものは 1, 2, \ldots, 99 個です。


入力例 2

136

出力例 2

46

1, 2, \ldots, 9 に加えて、100, 101, \ldots, 13637 個の数も桁数が奇数です。


入力例 3

100000

出力例 3

90909

Score : 200 points

Problem Statement

Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Constraints

  • 1 \leq N \leq 10^5

Input

Input is given from Standard Input in the following format:

N

Output

Print the number of positive integers less than or equal to N that have an odd number of digits.


Sample Input 1

11

Sample Output 1

9

Among the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \ldots, 9.


Sample Input 2

136

Sample Output 2

46

In addition to 1, 2, \ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \ldots, 136.


Sample Input 3

100000

Sample Output 3

90909