#include <iostream>
using namespace std;
int main()
{
int n, k=1,k1;
int count1 = 0,count=0;
char arr[100] = { 0 };
cin >> n;
while (k<=n)
{
k1 = k;
for (int i = 0; k1 > 0; i++)
{
arr[i] = k1 % 10;
k1 = k1 / 10;
count++;
}
for (int i = 0; i < count/2; i++)
{
if (arr[i] == arr[count - i - 1])
{
count1++;
}
}
if (count1 == count/2)
{
cout << k << endl;
}
k++;
count1 = 0;
count = 0;
}
}
using namespace std;
int main()
{
int n, k=1,k1;
int count1 = 0,count=0;
char arr[100] = { 0 };
cin >> n;
while (k<=n)
{
k1 = k;
for (int i = 0; k1 > 0; i++)
{
arr[i] = k1 % 10;
k1 = k1 / 10;
count++;
}
for (int i = 0; i < count/2; i++)
{
if (arr[i] == arr[count - i - 1])
{
count1++;
}
}
if (count1 == count/2)
{
cout << k << endl;
}
k++;
count1 = 0;
count = 0;
}
}