#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        int tmp = i, t = 0;
        while(tmp){
            t = t * 10 + tmp % 10;
            tmp /= 10;
        }
        if(t == i){
            printf("%d\n", i);
        }
    }
    return 0;
}