
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner scanner=new Scanner(System.in);
        int A=scanner.nextInt();
        int B=scanner.nextInt();
        int result=0;
        for(int i=A;i<=B;i++){
            if(isKaibun(i)) result++;
        }
        System.out.println(result);
    }
    public static boolean isKaibun(int x){
        int a=x/10000;
        int b=(x-a*10000)/1000;
        int c=(x-a*10000-b*1000)/100;
        int d=(x-a*10000-b*1000-c*100)/10;
        int e=(x-a*10000-b*1000-c*100-d*10);
        return a==e&&b==d;
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner scanner=new Scanner(System.in);
        int A=scanner.nextInt();
        int B=scanner.nextInt();
        int result=0;
        for(int i=A;i<=B;i++){
            if(isKaibun(i)) result++;
        }
        System.out.println(result);
    }
    public static boolean isKaibun(int x){
        int a=x/10000;
        int b=(x-a*10000)/1000;
        int c=(x-a*10000-b*1000)/100;
        int d=(x-a*10000-b*1000-c*100)/10;
        int e=(x-a*10000-b*1000-c*100-d*10);
        return a==e&&b==d;
    }
} Main public static void main(String[] args) {
	// write your code here
        Scanner scanner=new Scanner(System.in);
        int A=scanner.nextInt();
        int B=scanner.nextInt();
        int result=0;
        for(int i=A;i<=B;i++){
            if(isKaibun(i)) result++;
        }
        System.out.println(result);
    } main {
	// write your code here
        Scanner scanner=new Scanner(System.in);
        int A=scanner.nextInt();
        int B=scanner.nextInt();
        int result=0;
        for(int i=A;i<=B;i++){
            if(isKaibun(i)) result++;
        }
        System.out.println(result);
    } Scanner scanner=new Scanner(System.in); scanner new Scanner(System.in) int A=scanner.nextInt(); A scanner.nextInt() scanner.nextInt scanner int B=scanner.nextInt(); B scanner.nextInt() scanner.nextInt scanner int result=0; result 0 for(int i=A;i<=B;i++){
            if(isKaibun(i)) result++;
        } int i=A; int i=A; i A i<=B i B i++ i++ i {
            if(isKaibun(i)) result++;
        } {
            if(isKaibun(i)) result++;
        } if(isKaibun(i)) result++; isKaibun(i) isKaibun i result++ result System.out.println(result) System.out.println System.out System System.out result String[] args args public static boolean isKaibun(int x){
        int a=x/10000;
        int b=(x-a*10000)/1000;
        int c=(x-a*10000-b*1000)/100;
        int d=(x-a*10000-b*1000-c*100)/10;
        int e=(x-a*10000-b*1000-c*100-d*10);
        return a==e&&b==d;
    } isKaibun {
        int a=x/10000;
        int b=(x-a*10000)/1000;
        int c=(x-a*10000-b*1000)/100;
        int d=(x-a*10000-b*1000-c*100)/10;
        int e=(x-a*10000-b*1000-c*100-d*10);
        return a==e&&b==d;
    } int a=x/10000; a x/10000 x 10000 int b=(x-a*10000)/1000; b (x-a*10000)/1000 (x-a*10000) x a*10000 a 10000 1000 int c=(x-a*10000-b*1000)/100; c (x-a*10000-b*1000)/100 (x-a*10000-b*1000) x-a*10000-b*1000 x a*10000 a 10000 b*1000 b 1000 100 int d=(x-a*10000-b*1000-c*100)/10; d (x-a*10000-b*1000-c*100)/10 (x-a*10000-b*1000-c*100) b*1000 x-a*10000-b*1000-c*100 x a*10000 a 10000 b*1000 b 1000 c*100 c 100 10 int e=(x-a*10000-b*1000-c*100-d*10); e (x-a*10000-b*1000-c*100-d*10) c*100 b*1000 x-a*10000-b*1000-c*100-d*10 x a*10000 a 10000 b*1000 b 1000 c*100 c 100 d*10 d 10 return a==e&&b==d; a==e&&b==d a==e a e b==d b d int x x public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner scanner=new Scanner(System.in);
        int A=scanner.nextInt();
        int B=scanner.nextInt();
        int result=0;
        for(int i=A;i<=B;i++){
            if(isKaibun(i)) result++;
        }
        System.out.println(result);
    }
    public static boolean isKaibun(int x){
        int a=x/10000;
        int b=(x-a*10000)/1000;
        int c=(x-a*10000-b*1000)/100;
        int d=(x-a*10000-b*1000-c*100)/10;
        int e=(x-a*10000-b*1000-c*100-d*10);
        return a==e&&b==d;
    }
} public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner scanner=new Scanner(System.in);
        int A=scanner.nextInt();
        int B=scanner.nextInt();
        int result=0;
        for(int i=A;i<=B;i++){
            if(isKaibun(i)) result++;
        }
        System.out.println(result);
    }
    public static boolean isKaibun(int x){
        int a=x/10000;
        int b=(x-a*10000)/1000;
        int c=(x-a*10000-b*1000)/100;
        int d=(x-a*10000-b*1000-c*100)/10;
        int e=(x-a*10000-b*1000-c*100-d*10);
        return a==e&&b==d;
    }
} Main

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner scanner=new Scanner(System.in);
        int A=scanner.nextInt();
        int B=scanner.nextInt();
        int result=0;
        for(int i=A;i<=B;i++){
            if(isKaibun(i)) result++;
        }
        System.out.println(result);
    }
    public static boolean isKaibun(int x){
        int a=x/10000;
        int b=(x-a*10000)/1000;
        int c=(x-a*10000-b*1000)/100;
        int d=(x-a*10000-b*1000-c*100)/10;
        int e=(x-a*10000-b*1000-c*100-d*10);
        return a==e&&b==d;
    }
}
