import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        for(int i = 1; i <= n; i++) {
            int x = 0;
            int z = i;
            while(z != 0) { 
                x *= 10;
                x += z % 10;
                z = z / 10;
            }
            if(x == i) {
                System.out.println(i);
            }
        }
    }
}