n = int(input())
for i in range(1,n+1):
    s = str(i)
    d = s[::-1]
    x = int(d)
    if i == x:
        print(i)