import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) {
int count=0;
for(int i=2022;i<=2022222022;i++) {
boolean b=check(i);
if(b) {
count++;
}
}
System.out.println(count);
}
public static boolean check(int k) {
// TODO Auto-generated method stub
String s=String.valueOf(k);
char[] c=s.toCharArray();
for(int i=0;i<c.length;i++) {
if((c[i]-'0')!=(c[c.length-i-1]-'0')) {
return false;
}
}
if(c.length%2==0) {
for(int i=0;i<c.length*0.5;i++) {
int temp=c[i]-'0';
if(temp>(c[i+1]-'0')) {
return false;
}
}
}else {
for(int i=0;i<(int)Math.floor((double)c.length*0.5);i++) {
int temp=c[i]-'0';
if(temp>(c[i+1]-'0')) {
return false;
}
}
if((c[(int)Math.floor((double)c.length*0.5)]-'0')<(c[(int)Math.floor((double)c.length*0.5)-1]-'0')) {
return false;
}
}
return true;
}
}
结果:3138