Problem:
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

Solution in Python (3.4.3) (judge verdict: Wrong Answer)

tmp = int(input())
#tmp = 10000
input_num = tmp

lst = []
while tmp > 0:
    lst.append(tmp % 10)  # 余りが入るから右の桁から処理される。　例 345/10 % = 5
    tmp //= 10  # 必須
lst.reverse()


#print(lst)

#print(input_num)

ketasuu = len(lst)
ans = 0
flag = 0
tmp = 0

kazoeru = ketasuu - 1

#桁数が偶数のとき
if ketasuu % 2 == 0:
    for keta_num in reversed(range(kazoeru)):

        if flag == 0:
            tmp = (10**keta_num) * 9
            ans = ans + tmp
            #print("{} {}".format(ans,tmp))
            flag = 1
        else:
            flag = 0

#桁数が奇数のとき
else:
    #print((10**ketasuu) * lst[0])
    ans = input_num - ((10**kazoeru) * lst[0])

    for keta_num in reversed(range(kazoeru-1)):

        if flag == 0:
            tmp = (10**keta_num) * 9
            ans = ans + tmp
            #print("{} {}".format(ans,tmp))
            flag = 1
        else:
            flag = 0
            
    ans = ans + 1

print(ans)