#include <stdio.h>
int main() {
    int n = 0;
    scanf("%d", &n);
    //int x = 0;//回文数---》对称相等
    for (int i = 1; i <= n; i++){
        int x = 0; //之前x发生错误原因:x在循环外,使得每次结果未能重置为零
        int j = i;
        while (j>0) {
            x = x + j % 10; //保留最后一位
            j = j / 10;
            if (j>0) {
             x = x*10;
            } 
        }
        if (x==i) {
            printf("%d\n",i);
        }
        //printf("%d\n",x);
    }
    return 0;
}