n = int(eval(input()))

ans = 0



for i in range(1,n+1):

    digit = 1

    while i//10 > 0:

        digit += 1

        i /= 10

    if digit%2 == 1:

        ans += 1

print(ans)
n = int(eval(input()))

ans = 0

for i in range(1,n+1):

    if len(str(i))%2 == 1:

        ans += 1



print(ans)
n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
    digit = 1
    while i // 10 > 0:
        digit += 1
        i /= 10
    if digit % 2 == 1:
        ans += 1
print(ans)

n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
    if len(str(i)) % 2 == 1:
        ans += 1
print(ans)

-    digit = 1 -    while i // 10 > 0: -        digit += 1 -        i /= 10 -    if digit % 2 == 1: +    if len(str(i)) % 2 == 1: