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 (Python):


def main():

    N = int(input())
    one=9
    hun=900
    man=90000

    if N <= 9:
        print(N)
        exit()
    elif N <= 99:
        print(9)
        exit()
    elif N <= 999:
        print(N-99+9)
        exit()
    elif N <= 9999:
        print(909)
        exit()
    elif N <= 99999:
        print(N-9999+909)
        exit()
    else:
        print(90909)




    
if __name__== "__main__":
    main()

Solution (Python):
N = input()

buff = int(N)
N = list(N)

keta = len(N)
ans = 0
if keta % 2 == 0:
    gain = 1
    for i in range(0, keta-1, 2):
        ans += (9*gain)
        gain = gain * 100

    print(ans)

else:
    if keta == 1:
        print(N[0])
        exit()

    gain = 1
    for i in range(0, keta-1, 2):
        ans += (9*gain)
        gain = gain * 100

    gg = 9
    for i in range(keta-2):
        gg *= 10
        gg += 9
    
    ans += buff-gg
    print(ans)

Solution (Python):
a = int(input())
if a <10:
  print("{}".format(a))
elif a <100:
  print("9")
elif a < 1000:
  print("{}".format(9+a-99))
elif a < 10000:
  print('909')
elif a < 100000:
  print("{}".format(909+a-9999))
else:
  print('90909')

Solution (Python):
N = int(input())

ans = 0
i = 0

while N >= 10**(i+1):
    if i%2 == 0:
        ans += 10**(i+1)- 10**i
    i += 1

if i%2 == 0:
    ans += N - 10**i + 1
print(ans)

Solution (Python):
n=int(input())
if n<10:
	kazu=n
else:
	if n<100:
		kazu=9
	else:
		if n<1000:
			kazu=n-90
		else:
			if n<10000:
				kazu=909
			else:
				if n<100000:
					kazu=n-9090
				else:kazu=90909
print(kazu)

Solution (Python):


N = int(input())

range_num = 0
odd_num = 0

for i in range(7):
    if N % (10 ** i) == N:
        range_num = i
        break

if range_num == 1:
    odd_num = N
elif range_num == 2:
    odd_num = 9
elif range_num == 3:
    odd_num = N - 90
elif range_num == 4:
    odd_num = 909
elif range_num == 5:
    odd_num = N-9090
elif range_num == 6:
    odd_num = 90909
else:
    print("out of range")

print(odd_num)

Solution (Python):
n = int(input())

if len(str(n)) % 2 == 0:
  print(int("90" * int(len(str(n)) / 2 - 1) + "9"))
elif len(str(n)) == 1:
  print(n)
else:
  print(n - int("9" * (len(str(n)) -1)) + int("90" * (int((len(str(n)) - 1) / 2) - 1) + "9"))

Solution (Python):
n = int(input())

base = 1
odd = False

ans = 0

while  n >= base:
    if odd:
        pass
    else:
        if n >= (base * 10):
            ans += (base * 10 - base)
        else:
            ans += n - base + 1
    base *= 10
    odd = not odd

print(ans)

Solution (Python):
n=input()
count=0
if len(n)==1:
  count=int(n)
if len(n)==2:
  count+=9
if len(n)==3:
    count+=(int(n)//100-1)*100+int(n)%100+10
if len(n)==4:
    count+=909
if len(n)==5:
      count+=(int(n)//10000-1)*10000+int(n)%10000+910
if len(n)==6:
      count+=90909
print(count)

Solution (Python):
import math

N = int(input())
ans = int(0)
s = math.ceil(math.log10(N+1))


if s == 1:
    ans = N
elif s==2:
    ans = 9
elif s==3:
    ans = (N//100-1)*100+N%100+10
elif s==4:
    ans = 909
elif s==5:
    ans = (N//10000-1)*10000+N%10000+910
elif s==6:
    ans = 90909


print(ans)

Solution (Python):
num=int(input())
if len(str(num)) %2 != 0:
  if len(str(num))==7:
    print(num-999999+90000+900+9)
  elif len(str(num))==5:
    print(num-9999+900+9)
  elif len(str(num))==3:
    print(num-99+9)
  elif len(str(num))==1:
    print(num)
else:
  if len(str(num))==8:
    print(9000000+90000+900+9)
  elif len(str(num))==6:
    print(90000+900+9)
  elif len(str(num))==4:
    print(900+9)
  elif len(str(num))==2:
    print(9)

Solution (Python):

N = input()
lenN = len(N)
N = int(N)
ls = [N, 9 , N -90, 909, N-9090, 90909]
print (ls[lenN-1])

Solution (Python):
import sys
import collections
import copy
input = sys.stdin.readline
N=int(input())
ans = 0
for i in range(N):
    if int(len(str(i+1)))%2 ==1:
        ans += 1
print(ans)

Solution (Python):
n = int(input())

one = n % 10
hund = n // 100
thou = n // 1000
cnt = 0

if  n < 10:
    cnt += n

elif 100 > n >= 10:
    cnt += 9

elif 1000 > n >= 100:
    cnt += (n - 99) + 9

elif 10000 > n >= 1000:
    cnt += 909

elif 100000 > n >= 10000:
    cnt += (n - 9999) + 909

elif n == 100000:
    cnt += 90909

print(cnt)

Solution (Python):
n = int(input())
digit = len(str(n))
if digit%2 != 0:
    if digit == 1:
        print(n)
    elif digit == 3:
        print(n-90)
    else:
        print(n-10000+900+10)
else:
    if digit == 2:
        print(9)
    elif digit == 4:
        print(909)
    else:
        print(90909)

Solution (Python):
c=0
n=int(input())
for n in range(1,n+1):
    if (n<10 or (100<=n and n<1000) or (10000<=n and n<100000)):
        c=c+1
print(c)

Solution (Python):
count = 0
a = int(input())
for row in range(a):
	if len(str(row + 1)) % 2 == 0:
		pass
	else:
		count += 1
print(count)

Solution (Python):
N = int(input())
cnt = 0
for i in range(1,N+1):
    if len(str(i))%2 == 1:
        cnt += 1
print(cnt)

Solution (Python):
import math
N = int(input())


a = int(math.log10(N))
count = 0

for x in range(1, N+1):
    
    y = int(math.log10(x) + 1)
    if y % 2 == 1:
        count += 1

print(count)

Solution (Python):
n = int(input())
l = len(str(n))
if l == 1:
    print(n)
if l == 2:
    print(9)
if l == 3:
    print(9 + (n - 99))
if l == 4:
    print(909)
if l == 5:
    print(909 + (n - 9999))
if l == 6:
    print(90909)

Solution (Python):
n=int(input())
c=0
for i in range(1,n+1):
  if (len(str(i))%2!=0):
    c+=1
print(c)

Solution (Python):
from sys import stdin


n = int(stdin.readline().rstrip())

def main():
    keta = len(str(n))
    odd = [ i for i in range(1,(n + 1)) if len(str(i)) % 2 != 0 ]
    print("{}".format(len(odd)))


if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())

if 1<=N and N<=9:
  result=N
elif 10<=N and N<100 :
  result=9
elif 100<= N and N<1000:
  result=N-90
elif 1000<=N and N<10000:
  result=909
elif 10000<=N and N<100000:
  result=N-9090
elif N==100000:
  result=90909
  
print(result)

Solution (Python):
def main():
    N = input()
    i = 0
    while int(N) >0:
        if len(N) % 2 != 0:
            i+=1
        N = int(N) -1
        N = str(N)
    print(i)
main()

Solution (Python):
n = input()
keta = len(n)
N = int(n)

k = 0

if keta == 1:
    k = N
elif keta % 2 == 0:
    for i in range(keta):
        if (i+1) % 2 == 0:
            continue
        k += 9*(10**i)
    
else:
    for i in range(keta-1):

        if (i+1) % 2 == 0:
            continue
        k += 9*(10**i)

    minus = (10**(keta-1))
 
    k += (N-minus+1)
print(k)

Solution (Python):
n = input()

count = 0

l = len(n)

if l % 2:
  num = n[0:l]
  tmp = 1
  for i in range(l-1):
    tmp *= 10
  count += int(num) - tmp + 1
  l -= 1

for i in range(l):
  tmp = 1
  if (i+1) % 2:
    for j in range(i+1):
      tmp *= 10
    tmp -= int(float(tmp) / float(10))
    count += tmp
    
print(count)

Solution (Python):
n_str = input()
n_int = int(n_str)



exs_list = []
for i in range(1, 100000):
    if len(str(i)) % 2 == 1:
        exs_list.append(i)

exs = {i: i for i in exs_list}

n_s = []
ans = 0
for i in range(1, n_int + 1):
    if len(str(i)) % 2 == 0:
        continue
    if i in exs:
        ans += 1

print(ans)

Solution (Python):
N = int(input())
a = len(str(N))
ans = 0
for i in range(1, a):
    if i%2 == 1:
        ans += 9*(10**(i-1))
if a%2 == 1:
    ans += N + 1 - 10**(a-1)
print(ans)

Solution (Python):
n = int(input())
count = 0

for i in range(1, n+1):
    if len(str(i)) % 2 != 0:
        count += 1
print(count)

Solution (Python):
n = int(input())
     
cnt = 0
for i in range(1, n+1):
    str_n = str(i)
    if len(str_n) % 2 != 0:
        cnt += 1
            
print(cnt)

Solution (Python):
N = int(input())

print(len([i for i in range(1, N + 1) if len(str(i)) % 2 == 1]))

Solution (Python):
n = int(input())
digit = len(str(n))

count = 0
for i in range(digit - 1):
  if (i + 1) % 2 == 1:
    count += 10 ** (i + 1) - (10 ** i)

if digit % 2 == 1:
  count += n - 10 ** (digit - 1) + 1

print(count)

Solution (Python):
N = int(input())
v = 0
if N >= 10:
    v += 9
    if N >= 100:
        if N >= 1000:
            v += 900
            if N >= 10000:
                if N >= 100000:
                    v += 90000
                    if N >= 1000000:
                        pass
                else:
                    v += N % 100000 - 10000 + 1
        else:
            v += N % 1000 - 100 + 1
else:
    v += N % 10
print(v)

Solution (Python):
N = input().strip()
N = N + "."  
N.strip("0")
N = N[:-1]
total = 0
for i in range(1, len(N), 2):
    total += int("1"+"0"*i) - int("1"+"0"*(i-1))
if len(N) % 2 == 0:
    total += 0
else:
    total += int(N) - (int("1" + "0" * (len(N) - 1))) + 1
print(total)

Solution (Python):

n = int(input())
count = 0
lenn = len(str(int(n)))
if lenn == 1:
    count += n
else:
    for i in range(1,lenn+1):
        if i == 1:
            count += 9
        elif i == lenn:
            if i % 2 == 0:
                pass 
            else:
                count += n - (10**(i - 1)) + 1
        elif i % 2 == 0:
            pass
        else:
            count += ((10**i) - 1) - (10**(i-1)) + 1
        
print(count)

Solution (Python):
n = int(input())
ans = 0
for i in range(1, n+1):
    if i < 10 or (i >= 100 and i < 1000) or (i >= 10000 and i < 100000):
        ans += 1
print(ans)

Solution (Python):
num =  int(input())
cnt = 0

for i in range(num,0,-1) :
    if(len(str(i))%2 != 0):
        cnt += 1

print(cnt)

Solution (Python):
n=int(input())
c=0
for i in range(1,n+1):
  if (len(str(i))%2!=0):
    c+=1
print(c)

Solution (Python):
N = int(raw_input())
ans = 0
for x in xrange(1, N+1):
    if len(str(x)) % 2:
        ans += 1
print ans

Solution (Python):
N = int(input())

num = 0
for i in range(1, N+1):
    if (len(str(i))%2)==1:
       num = num + 1

print(num)

Solution (Python):



N = int(input())

count = 0
for number in range(N):
    slen = len(str(number+1))
    if slen % 2 == 1:
        count += 1

print("{}".format(count))

Solution (Python):
n = int(input())

l = len(str(n))

ans=0

if l==1:
    ans=n
elif l==2:
    ans=9
elif l==3:
    ans=n-90
elif l==4:
    ans=909
elif l==5:
    ans=n-9090
elif l==6:
    ans=90909
    

print(ans)

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

Solution (Python):
N=input()
n=int(N)
if len(N)==1:
  print(n)
elif len(N)==2:
  print(9)
elif len(N)==3:
  print(9+(n-99))
elif len(N)==4:
  print(909)
elif len(N)==5:
  print(909+(n-9999))
else:
  print(90909)

Solution (Python):
N=input()
i=int(len(N))
N=int(N)

x=0
if i%2!=0:
    x=N-10**(i-1)+1
    i=i-1
    if i!=0:
        while i>0:
            i=i-2
            x=x+9*(10**i)
else:
    if N<10:
        x=N
    else:
        while i>1:
            x=x+9*(10**(i-2))
            
            i=i-2

print(x)

Solution (Python):
n = int(input())
count = 0
for i in range(1, n + 1):
    temp = str(i)
    if len(temp)%2 == 1:
        count += 1
        
print(count)

Solution (Python):
n=int(input())
n_=str(n)
a=len(n_)
ans=0
for i in range(a-1):
  if (i+1)%2==1:
    ans+=9*10**(i)
if a%2==1:
  ans+=n-10**(a-1)+1
print(ans)

Solution (Python):
N = input()
keta = len(N)

ans = 0
keta_half = keta // 2

if keta_half > 0:
    if keta % 2 == 0:
        for i in range(keta_half):
            ans += 9 * 10 ** (2*i)
    else:
        for i in range(keta_half):
            ans += 9 * 10 ** (2*i)
        
        zan = int(N) - 10 ** (keta-1)  + 1
        ans += zan
else:
    ans = int(N)

print(ans)

Solution (Python):
import math


def main():
    n = int(input())
    ans = 0
    for i in range(1, n + 1):
        if math.log(i, 10) % 2 // 1 == 0 and i != 1000:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
l = int((len(str(n))+1)/2)
s = 0
for i in range(1,l):
  s += 10**(2*i-1)-10**(2*i-2)
k = len(str(n))
if k == l*2:
  s += 10**(2*l-1)-10**(2*l-2)
else:
  s += n+1-10**(2*l-2)
print(s)

Solution (Python):
N = int(input())

count = -1
for i in range(N+1):
    a = len(str(i))
    if a % 2 ==  1:
        count += 1
if count >= 0:
    print(count)
else:
    print(0)

Solution (Python):
a=int(input())
b = min(a,9)
if a>=100:
    b += min(a-99,900)
if a>=10000:
    b += min(a-9999,90000)
if a>=1000000:
    b += min(a-999999,9000000)
print(b)

Solution (Python):
N = int(input())
ans = 0

for i in range(1, 10):
  if i > N:
    break
  else:
    ans += 1

for i in range(100, 1000):
  if i > N:
    break
  else:
    ans += 1

for i in range(10000, 100000):
  if i > N:
    break
  else:
    ans += 1

print(ans)

Solution (Python):
N = int(input())
ans = 0
for n in range(1, N+1):
    ans += len(str(n))%2
print(ans)

Solution (Python):
N = input()
cnt = 0
for i in range(1, int(N)+1):
  if len(str(i)) % 2 == 1:
    cnt += 1
print(cnt)

Solution (Python):
n=int(input())

if len(str(n)) == 1:
  print(n)
elif len(str(n)) == 2:
  print(9)
elif len(str(n)) == 3:
  print(9+n-99)
elif len(str(n)) == 4:
  print(9+900)
elif len(str(n)) == 5:
  print(9+900+n-9999)
elif len(str(n)) == 6:
  print(90909)

Solution (Python):
n = input()
if(len(n) == 1):
    print(n)
    exit()
ans = 0
if len(n) % 2:
    ans += int(n) - 10 ** (len(n) - 1) + 1
    print(str(int('90' * ((len(n) - 3) // 2) + '9') + ans))

else:
    print(str(int('90' * ((len(n) - 2) // 2) + '9')))

Solution (Python):
n = input()
l = len(n)


temp=''
ans=0

if l==1:
	print(int(n))
else:
	for i in range(1,l):
		if i%2==1:
			temp='9'
			temp+='0'*(i-1)
			ans+=int(temp)
			

	if l%2==1:
		ans+=(int(n)-int('9'*(l-1)))

	print(ans)

Solution (Python):
import math

N=int(input())

keta=0
while N>=math.pow(10,keta):
	keta += 1

count=0
if keta%2==1:
	count = N-int(math.pow(10,keta-1))+1
	keta -= 1
while keta>=2:
	count += 9*int(math.pow(10,keta-2))
	keta -= 2

print(count)

Solution (Python):

import numpy as np

n = int(input())

cnt = 0
for i in range(n):  
    i += 1
    if len(str(i))%2 != 0:
        cnt += 1

print(cnt)

Solution (Python):
n = int(input())
cnt = 0
for i in range(1, n + 1):
    if len(str(i)) % 2 != 0:
        cnt += 1

print(cnt)

Solution (Python):
n = int(input())
sum = 0
if n//10!=0:
  sum+=9
  if n//1000!=0:
    sum+=900
    if n//100000!=0:
      sum+=90000
    elif n//10000!=0:
      sum+=n-9999
  elif n//100!=0:
    sum+=n-99
else:
  sum+=n
print(sum)

Solution (Python):
n = int(input())
count = 0

for i in range(1, n+1):
    if len(str(i)) % 2 == 1:
        count += 1

print(count)

Solution (Python):
n=int(input())
answer=0
for i in range(6):
  if n/(10**i)>=1:
    if i%2==1:
      answer+=10**i-(10**(i-1))
  else:
    if i%2==1:
      answer+=(n-(10**(i-1))+1)
    break
print(answer)

Solution (Python):
a = int(input())
if a < 10:
    print(a)
elif a < 100:
    print(9)
elif a < 1000:
    d = a -99
    print(9 + d)
elif a < 10000:
    print(909)
elif a < 100000:
    d = a - 9999
    print(9+900+d)
elif a == 100000:
    print(90909)

Solution (Python):
N = int(input())

numOfDigit = 1
answer = 0

n = 1
while(N >= n * 10):
    if (numOfDigit % 2):
        answer += n * 9
    numOfDigit += 1
    n *= 10

if (numOfDigit % 2):
    answer += N % (n * 10) - n + 1

print(answer)

Solution (Python):
N = int(input())
n = len(list(str(N)))
cnt = 0
if n==1:
    print(N)
else:
    for i in range(n//2):
        cnt += 9 * (10 ** (2 * i))  
    if n%2==1:
        cnt += N - (10 ** (2 * (n//2))) + 1
    print(cnt)

Solution (Python):
N = input()
if len(N) == 1:
    print(N)
elif len(N) == 2:
    print(9)
elif len(N) == 3:
    print(9 + int(N[0])*100 - 100 + int(N[1:]) + 1)
elif len(N) == 4:
    print(9 + 900)
elif len(N) == 5:
    print(9 + 900 + 10000*int(N[0]) - 10000 + int(N[1:]) + 1)
elif len(N) == 6:
    print(9 + 900 + 90000)

Solution (Python):


N = input()
K = int(len(N))
A = 0

if K % 2 == 0:
	for i in range(0,K,2):
		A += 9 * 10 ** i
elif K == 1:
	A = N
else:
	for i in range(0,K - 1,2):
		A += 9 * 10 ** i

if K % 2 != 0 and K != 1:
	A += int(N) - 10**(K - 1) + 1

print(A)

Solution (Python):
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    str_n = input()
    n = int(str_n)
    len_n = len(str_n)
    if len_n % 2 == 0:
        if len_n == 6:
            print(90909)
        elif len_n == 4:
            print(909)
        else:
            print(9)
    else:
        if len_n == 5:
            print(909 + n - 10000 + 1)
        elif len_n == 3:
            print(9 + n - 100 + 1)
        else:
            print(n)

Solution (Python):
N=input()
C=len(N)

if C % 2 == 0:
  a ="09"
  a=a*(int(C/2))
  print(int(a))
elif C==1:
  print(int(N))
else:
  e = int(N)-10**(C-1)+1
  a = "09"
  a = a * (int((C-1)/2))
  print(int(a)+e)

Solution (Python):
n = str(input())
d = 0
if len(n)%2 == 0:
    for i in range(int(len(n)/2)):
        d += 9*(10**(i*2))
else:
    l = len(n)
    for j in range(l//2):
        d += 9*(10**(j*2))
    d += int(n)-10**(len(n)-1)+1
print(d)

Solution (Python):
import math
a = int(input())
if ((a > 0) & (a < 100001)):
    data_size = int (math.log10(a) + 1)
    if a == 100000:
        print(90909)
    elif data_size == 5:
        print(a - 10000 + 1 + 909)
    elif data_size == 4:
        print(909)
    elif data_size == 3:
        print(a - 100 + 1 + 9)
    elif data_size == 2:   
        print(9)
    elif data_size == 1:   
        print(a - 1 + 1)

Solution (Python):
N = int(input())

if N < 10:
    print(N)
elif 10 <= N and N < 100:
    print(9)
elif 100 <= N and N < 1000:
    ans = 9 + N - 99
    print(ans)
elif 1000 <= N and N < 10000:
    ans = 9 + 999 - 99
    print(ans)
elif 10000 <= N and N < 100000 :
    ans = 909 + N - 9999
    print(ans)
elif N == 100000 :
    ans = 909 + 99999 - 9999
    print(ans)

Solution (Python):
import sys


		
def main():
	n = int(input())
	l=[i for i in range(n) if len(str(i+1)) % 2 == 1]
	print(len(l))
	
	


if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Solution (Python):
N = int(input())

keta = len(str(N))
if keta%2 == 0:
    N = 10**(keta-1)-1
total = N
keta = len(str(N))
if keta == 3:
    total -= 90
elif keta == 5:
    total -= 100000-90910

print(total)

Solution (Python):
N= int(input())
N_length = len(str(N))
if(N_length == 1):
  print (int(N))
elif(N_length == 2):
  print (9)
elif(N_length == 3):
  print (9+N-100+1)
elif(N_length == 4):
  print (9 +900)
elif(N_length == 5 ):
  print (9+900 + N - 10000 + 1)
elif(N_length == 6):
  print (9+900 + 90000)

Solution (Python):

n=input()
keta = len(n)
keta_num = 0
for k in range(1,keta):
    if(k%2==1):
        keta_num += (10**k)-(10**(k-1))
if(keta%2==1):
    n_int = int(n)
    keta_num += n_int - (10**(keta-1))+1
if(keta==1):    
    print(int(n))
else:
    print(keta_num)

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

Solution (Python):
"""
https://atcoder.jp/contests/abc136/tasks/abc136_b
"""

import math

import numpy as np


def calc(N: int) -> int:
    if N == 0:
        return 0

    keta_suu = calc_ketasuu(N)

    
    max_keta_count = N - 10 ** (keta_suu - 1) + 1 if is_odd(keta_suu) else 0

    
    other_keta_count = 0
    for keta in range(keta_suu):
        if not is_odd(keta):
            continue
        other_keta_count += 10 ** keta - 10 ** (keta - 1)

    return max_keta_count + other_keta_count


def calc_ketasuu(value: int) -> int:
    return int(math.log10(value) + 1)


def is_odd(value: int) -> bool:
    return value % 2 == 1


def load_input_as_int_array() -> np.ndarray:
    return np.array([int(v) for v in input().split(" ")])


def main() -> None:
    N, = load_input_as_int_array()
    result = calc(N)
    print(result)


main()

Solution (Python):
from enum import Enum
from queue import Queue
import collections

import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

N = int(input())

digit_num = len(str(N))

ans = 0

if digit_num % 2 !=0:
    ans += N-10**(digit_num-1)+1

for i in reversed(range(1,digit_num)):
    if i % 2 != 0:
        ans += 9*(10**(i-1))

print(ans)

Solution (Python):
n = int(input())
count = 0
for i in range(n):
  if len(str(i + 1)) % 2 == 1:
    count += 1
print(count)

Solution (Python):
N = int(input()) 

ans = 0

for num in range(1,N+1):
  
  if int(len(str(num))) % 2 == 1:
     ans += 1
      
print(int(ans))

Solution (Python):
N = int(input())
count = 0
for i in range(1, 6):
    if N-(10**i) < 0:
        break;
    else:
        count += 1
if count == 0:
    p = N
elif count == 1: 
    p = 9
elif count == 2:
    p = 9 + N - 100 + 1
elif count == 3:
    p = 909
elif count == 4:
    p = 909 + N - 10000 + 1
else:
    p = 90909
print(p)

Solution (Python):
n = int(input().split()[0])

str_n = str(n)
keta = len(str_n)

c = 0
keta_list = list(range(0, 6))
keta_list.reverse()


if 1 <= n < 10:
    c += n
else:
    c += 9


if n >= 100:
    
    if n <= 999:
        
        c += (n - 99)
    else:
        
        
        c += 900 


if n >= 10000:
    if n <= 99999:
        
        
        
        c += n - 9999
    else:
        
        
        c += 90000 

print(c)

Solution (Python):
i = input()
n = int(i)
len = len(i)

if len == 1:
  print(n)
elif len == 2:
  print(9)
elif len == 3:
  print(n - 90) 
elif len == 4:
  print(909) 
elif len == 5:
  print(n - 90 - 9000) 
elif len == 6:
  print(90909)

Solution (Python):
n = int(input())

if n >= 1 and n < 10:
  print(n)
elif n >= 10 and n < 100:
  print(9)
elif n >= 100 and n < 1000:
  print(n - 90)
elif n >= 1000 and n < 10000:
  print(909)
elif n >= 10000 and n < 100000:
  print(n - 9090)
elif n == 100000:
  print(90909)

Solution (Python):
N = int(input())
O = str(N)
if(len(O) == 1):
    print(N)
elif(len(O) == 2):
    print(9)
elif(len(O) == 3):
    print(N-90)
elif(len(O) == 4):
    print(909)
elif(len(O) == 5):
    print(N-9090)
else:
    print(90909)

Solution (Python):
n = input()
if len(n)<=1:
    ans = n
elif len(n)<=2:
    ans = 9
elif len(n)<=3:
    ans = int(n)-99+9
elif len(n)<=4:
    ans = 909
elif len(n)<=5:
    ans =int(n)-9999+909
else:
    ans = 90909
print(ans)

Solution (Python):

def main():
    
    N = int(input())

    length = len(str(N))
    counter = 0
    if length < 3:
        for _ in range(1, min(10, N+1)):
            counter += 1
    elif length < 5:
        counter = 9
        for _ in range(100, min(1000, N+1)):
            counter += 1
    else:
        counter = 909
        for _ in range(10000, min(100000, N+1)):
            counter += 1
    
    print(counter)


if __name__ == "__main__":
    main()

Solution (Python):
a = int(input())
l = len(str(a))

ans = 0
if l % 2 == 0:
    while l >= 1:
        ans += (10 ** (l - 1) - 1) - (10 ** (l - 2) - 1)
        l -= 2
else:
    ans += a - (10 ** (l - 1) - 1)
    l -= 1
    while l >= 1:
        ans += (10 ** (l - 1) - 1)  - (10 ** (l - 2) - 1)
        l -= 2

print(ans)

Solution (Python):
n = int(input())
L = len(str(n))



answer = 0
k = 0
if L == 1:
    print(n)
    
if L % 2 == 0:
    for i in range(1, L,2):
        answer += 9*10**(i-1)
    print(answer)

if L % 2 == 1 and not L ==1:
    
    for j in range(1, L,2):
        answer += 9*10**(j-1)
    k = answer + n - 10**(L-1) + 1
    print(k)

Solution (Python):
n = int(input())

if n < 10:  
    
    print(n)

elif n < 100:  
    
    print(9)

elif n < 1000:  
    
    print(n-99+9)

elif n < 10000:  
    
    print(9+900)

elif n < 100000:  
    
    print(n-9999+900+9)

else:  
    
    print(9+900+90000)

Solution (Python):
N = int(input())

lv1 = 10
lv2 = 1000
lv3 = 100000

mod1 = 100
mod2 = 10000

if (N / mod1 < 1):
    if (N < lv1):
        print(N)
    else:
        print(lv1 - 1)
elif (N / mod2 < 1):
    if (N < lv2):
        print(N - (mod1 - 1) + (lv1 - 1))
    else:
        print(lv2 - mod1 + lv1 - 1)
else:
    if (N < lv3):
        print(N - (mod2 - 1) + lv2 - mod1 + lv1 - 1)
    else:
        print(lv3 - mod2 + lv2 - mod1 + lv1 - 1)

Solution (Python):
A = int(input())

retval = 0
if (A == 100000):
  A = A-1
  
if (A >= 10000):
  retval += A-9999
  A = 9999
 
if (A >= 1000):
  A = 999

if (A>=100):
  retval += A-99
  A = 99
  
if (A>=10):
  A = 9
 
retval += A
print(retval)

Solution (Python):
n = int(input())
if n < 10:
  r = n
elif n < 10**2:
  r = 9
elif n < 10**3:
  r = n-99 + 9
elif n < 10**4:
  r = 999-99 + 9
elif n < 10**5:
  r = n-9999 + 999-99 + 9
elif n == 10**5:
  r = 99999-9999 + 999-99 + 9

print(r)

Solution (Python):
n=int(input())

k=str(n)
ans=0

for i in range(1,len(k),2):
  s="9"
  s*=i
  ans+=int(s)-int(s)//10
    
if(len(k)%2==1):
	m=pow(10,len(k)-1)
	ans+=n-m+1

print(ans)

Solution (Python):
N = int(input())

count = 0

if N < 10:
    print(N)
elif N < 100:
    print(9)
elif N < 1000:
    print(9 + min(N,999) - 100 + 1)
elif N < 10000:
    print(9 + 900)
elif N < 100000:
    print(9 + 900 + min(N , 99999) - 10000 + 1)
else:
    print(90909)

Solution (Python):
N = int(input())
count = 0
for i in range(1, N + 1):
    if 1 <= i <= 9: count += 1
    elif 100 <= i <= 999: count += 1
    elif 10000 <= i <= 99999: count += 1
print(count)

Solution (Python):

N = int(input())

N_len = len(list(str(N)))

def sn(n):
    if n==1:
        return 9
    else:
        return 9 * (1-100**n)//(1-100)

N_len_fix = (N_len+1)//2
if N_len%2==0:
    print(sn(N_len_fix))
else:
    print(sn(N_len_fix-1) + N - 10**(N_len-1)+1)

Solution (Python):
n = int(input())

c = 0
t = n
while t // 10 != 0:
    c += 1
    t = t // 10

ans = 0
if c == 0:
    ans = n
elif c == 1:
    ans = 9
elif c == 2:
    ans = n - 99 + 9
elif c == 3:
    ans = 909
elif c == 4:
    ans = n - 9999 + 909
else:
    ans = 90909

print(ans)

Solution (Python):
n= int(input())
s=0
for i in range(1,n+1):
    next = str(i)
    if len(next)%2:
        s+=1
print(s)

Solution (Python):
N = int(input())
count = 0

for i in range(1,N+1):
	if 0 < i <= 9:
		count += 1
	elif 100 <= i <= 999:
		count += 1
	elif 10000 <= i <= 99999:
		count += 1

print(count)

Solution (Python):
N = int(input())

count = 0
if N<10:
  print(N)
elif N<100:
  print(9)
elif N<1000:
  print(9+N-99)
elif N<10000:
  print(909)
elif N<100000:
  print(909+N-10000+1)
else:
  print(909+100000-10000)

Solution (Python):
from sys import stdin


def main():
    N = stdin.readline().rstrip()
    N_num = int(N)

    if len(N) == 1:
        print(N_num)

    elif len(N) == 2:
        print(9)

    elif len(N) == 3:
        print((N_num % 100) + (N_num//100-1)*100 + 10)

    elif len(N) == 4:
        print(909)

    elif len(N) == 5:
        print((N_num % 10000) + (N_num//10000-1)*10000 + 910)

    elif len(N) == 6:
        print(90909)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())

res = 0
for i in range(1, N + 1):
    if len(str(i)) % 2 == 1:
        res += 1

print(res)

Solution (Python):
N = int(input())

X = len(str(N))

if X == 1:
    print(N)
elif X == 2:
    print(9)
elif X == 3:
    print(9 + (N - 100 + 1))
elif X == 4:
    print(909)
elif X == 5:
    print(9 + 900 + (N - 10000 + 1))
elif X == 6:
    print(90909)

Solution (Python):
n = int(input())

ans = 0
for i in range(0, 6, 2):
  if i == 0:
    low = 1
  else:
    low = 10 ** i
  up = 10 ** (i + 1 ) - 1
  
  if up <= n:
    ans += up - low + 1
  else:
    if low <= n:
      ans += n - low + 1
    break
    
print(ans)

Solution (Python):
n = int(input())
s = len(str(n))

if s == 1:
    print(n)
elif s == 2:
    print(9)
elif s % 2 == 0:
    k = s//2
    sum = 0
    t = 1
    for i in range(1,k+1):
        sum += 9*t
        t *= 100
    print(sum)
        
else:
    k = (s-1)//2
    sum = 0
    t = 1
    for i in range(1,k+1):
        sum += 9*t
        t *= 100
    print(sum + n -10**(s -1) +1)

Solution (Python):
n = input()
nlen = len(n)

if nlen > 5:
  n5 = 90000
  n3 = 900
  n1 = 9
elif nlen == 5:
  n5 = int(n[-5:]) - 9999
  n3 = 900
  n1 = 9
elif nlen >3:
  n5 = 0
  n3 = 900
  n1 = 9
elif nlen == 3:
  n5 = 0
  n3 = int(n[-3:]) - 99
  n1 = 9
elif nlen > 1:
  n5 = 0
  n3 = 0
  n1 = 9
else:
  n5 = 0
  n3 = 0
  n1 = int(n[-1:])

print(n1 + n3 + n5)

Solution (Python):
N = int(input())

keta = len(str(N))

count = 0
for k in range(1, keta+1, 2):
  if k != keta:
    count += (10**(k) - 10**(k-1))
  elif k == keta:
    count += (N - 10**(k-1) + 1)
    
print(count)

Solution (Python):
N = int(input())

answer = 0
for x in range(1,N+1):
    if len(str(x)) & 1:
        answer += 1
        
print(answer)

Solution (Python):
n=input()

a=len(n)

n=int(n)

if a%2==1:
  
  print(int((100**(a//2)-1)/11+n-10**(a-1)+1))
  
else:
  
  print(int((100**(a/2)-1)/11))

Solution (Python):
import numpy as np
n = int(input())
digit= int(np.log10(n)//1)
tmp = 0
if digit%2==0 and n>=10:
  tmp = n-10**digit+1
elif n<10:
  tmp = n
for i in range(1,digit+1,2):
    tmp += 9*10**(i-1)
print(tmp)

Solution (Python):
N = int(input())
ketasu = len(str(N))

ans = 9
if (ketasu % 2 == 0) and (ketasu != 2):
    for i in range(2, ketasu, 2):
        ans += 9*(10**(i))
elif (ketasu % 2 != 0) and (ketasu != 1):
    for i in range(2, ketasu-1, 2):
        ans += 9*(10**(i))
    ans = ans + (N - 10**(ketasu-1) + 1)

if ketasu == 1:
    ans = N

print(ans)

Solution (Python):
N=str(input())
digit=len(N)
result=0

for i in range(1,digit+1):
    if i%2==1:
        if i==digit:
            result+=int(N)+1-10**(i-1)
        else:
            result+=9*10**(i-1)
print(result)

Solution (Python):
a = int(input())
ans = 0
if a < 10:
    ans = a
    print(ans)
elif 10 <= a < 100:
    print(9)
elif 100 <= a < 1000:
    ans = 9 + (a - 99)
    print(ans)
elif 1000 <= a < 10000:
    print(909)
elif 10000 <= a < 100000:
    ans = 9 + 900 + (a - 9999)
    print(ans)
else:
    print(90909)

Solution (Python):
print(sum([len(str(i)) % 2 for i in range(1, int(input()) + 1)]))

Solution (Python):
n=input()
l=len(n)
s=0
if l>1:
    if l%2==1:
        s+=int(n[1:])+1+(int(n[0])-1)*(10**(l-1))
        l-=1
    for i in range(int(l/2)):
        s+=9*10**(i*2)
    print(s)
else:
    print(int(n))

Solution (Python):
n = int(input())
length = len(str(n))
cnt = 0
odd_l = []
for i in range( len(str(n))):
    if ((i+1)%2 == 1) & (i != len(str(n))-1):
        cnt += 10**(i+1)-(10**i)
    elif (i+1)%2 == 1:
        for i in range(10**i, n+1):
            cnt += 1
            odd_l.append(i)
print(cnt)

Solution (Python):
n=int(input())

if n<=9:
	res=n
else:
	if n<=99:
		res=9
	else:
		if n<=999:
			res=n-99+9
		else:
			if n<=9999:
				res=909
			else:
				if n<=99999:
					res=n-9999+909
				else:
					res=90909

print(res)

Solution (Python):
N = input()
length = len(N)
count = 0
for i in range(1, length, 2):
    count = count + 10 ** i - 1 - 10 ** (i - 1) + 1

if length % 2 != 0:
    count = count + int(N) - 10 ** (length - 1) + 1

print(count)

Solution (Python):
s = input()
n = int(s)
l = len(s)
ans = 0
if(n < 10):
    print(n)
elif(n < 100):
    print(9)
elif(n < 1000):
    ans = 9
    ans += n-99
    print(ans)
elif(n < 10000):
    print(909)
elif(n < 100000):
    ans = 9+900
    ans += n-9999
    print(ans)
else:
    print(90909)