记录
#include <bits/stdc++.h>
using namespace std;
bool is_palindrome(int n)
{
int ans = 0, cnt = 0;
int res = n;
while (n > 0)
{
n /= 10;
cnt++;
}
n = res;
for (int i = 1; i <= cnt; i++)
{
ans = ans * 10 + n % 10;
n /= 10;
}
if (ans == res)
{
return true;
}
return false;
}
int main()
{
int n;
cin >> n;
int cnt = 0;
for (int i = 1; i <= n; i++)
{
if (is_palindrome(i)) cnt++;
}
cout << cnt;
return 0;
}