import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n1 = input.nextInt();
        int n2 = input.nextInt();
        extracted(n1, n2);
        input.close();
    }

	private static void extracted(int n1, int n2) {
        int count = 0;
		for(int i=n1;i<=n2;i++){
            int m1 = i / 10000;
            int m2 = i % 10;
            int m3 = i % 10000 / 1000;
            int m4 = i % 100 / 10;
            if (m1 == m2 && m3 == m4)
                count++;
        }
        System.out.println(count);
	}
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n1 = input.nextInt();
        int n2 = input.nextInt();
        extracted(n1, n2);
        input.close();
    }

	private static void extracted(int n1, int n2) {
        int count = 0;
		for(int i=n1;i<=n2;i++){
            int m1 = i / 10000;
            int m2 = i % 10;
            int m3 = i % 10000 / 1000;
            int m4 = i % 100 / 10;
            if (m1 == m2 && m3 == m4)
                count++;
        }
        System.out.println(count);
	}
} Main public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n1 = input.nextInt();
        int n2 = input.nextInt();
        extracted(n1, n2);
        input.close();
    } main {
        Scanner input = new Scanner(System.in);
        int n1 = input.nextInt();
        int n2 = input.nextInt();
        extracted(n1, n2);
        input.close();
    } Scanner input = new Scanner(System.in); input new Scanner(System.in) int n1 = input.nextInt(); n1 input.nextInt() input.nextInt input int n2 = input.nextInt(); n2 input.nextInt() input.nextInt input extracted(n1, n2) extracted n1 n2 input.close() input.close input String[] args args private static void extracted(int n1, int n2) {
        int count = 0;
		for(int i=n1;i<=n2;i++){
            int m1 = i / 10000;
            int m2 = i % 10;
            int m3 = i % 10000 / 1000;
            int m4 = i % 100 / 10;
            if (m1 == m2 && m3 == m4)
                count++;
        }
        System.out.println(count);
	} extracted {
        int count = 0;
		for(int i=n1;i<=n2;i++){
            int m1 = i / 10000;
            int m2 = i % 10;
            int m3 = i % 10000 / 1000;
            int m4 = i % 100 / 10;
            if (m1 == m2 && m3 == m4)
                count++;
        }
        System.out.println(count);
	} int count = 0; count 0 for(int i=n1;i<=n2;i++){
            int m1 = i / 10000;
            int m2 = i % 10;
            int m3 = i % 10000 / 1000;
            int m4 = i % 100 / 10;
            if (m1 == m2 && m3 == m4)
                count++;
        } int i=n1; int i=n1; i n1 i<=n2 i n2 i++ i++ i {
            int m1 = i / 10000;
            int m2 = i % 10;
            int m3 = i % 10000 / 1000;
            int m4 = i % 100 / 10;
            if (m1 == m2 && m3 == m4)
                count++;
        } {
            int m1 = i / 10000;
            int m2 = i % 10;
            int m3 = i % 10000 / 1000;
            int m4 = i % 100 / 10;
            if (m1 == m2 && m3 == m4)
                count++;
        } int m1 = i / 10000; m1 i / 10000 i 10000 int m2 = i % 10; m2 i % 10 i 10 int m3 = i % 10000 / 1000; m3 i % 10000 / 1000 i % 10000 i 10000 1000 int m4 = i % 100 / 10; m4 i % 100 / 10 i % 100 i 100 10 if (m1 == m2 && m3 == m4)
                count++; m1 == m2 && m3 == m4 m1 == m2 m1 m2 m3 == m4 m3 m4 count++ count System.out.println(count) System.out.println System.out System System.out count int n1 n1 int n2 n2
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n1 = input.nextInt();
        int n2 = input.nextInt();
        extracted(n1, n2);
        input.close();
    }

	private static void extracted(int n1, int n2) {
        int count = 0;
		for(int i=n1;i<=n2;i++){
            int m1 = i / 10000;
            int m2 = i % 10;
            int m3 = i % 10000 / 1000;
            int m4 = i % 100 / 10;
            if (m1 == m2 && m3 == m4)
                count++;
        }
        System.out.println(count);
	}
}