n = int(input())
s = ''
for i in range(1,n+1):
    if len(s)>=n:
        break
    else:
        s += str(i)
print(s[n-1])