import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] ab = scanner.nextLine().split(" ", 2);
        int a = Integer.parseInt(ab[0]);
        int b = Integer.parseInt(ab[1]);

        int count = 0;
        for (int i = a; i <= b; i++) {
            if (i / 10000 == i % 10 && (i % 10000) / 1000 == (i % 100) / 10) {
                count++;
            }
        }
        System.out.println(count);
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] ab = scanner.nextLine().split(" ", 2);
        int a = Integer.parseInt(ab[0]);
        int b = Integer.parseInt(ab[1]);

        int count = 0;
        for (int i = a; i <= b; i++) {
            if (i / 10000 == i % 10 && (i % 10000) / 1000 == (i % 100) / 10) {
                count++;
            }
        }
        System.out.println(count);
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] ab = scanner.nextLine().split(" ", 2);
        int a = Integer.parseInt(ab[0]);
        int b = Integer.parseInt(ab[1]);

        int count = 0;
        for (int i = a; i <= b; i++) {
            if (i / 10000 == i % 10 && (i % 10000) / 1000 == (i % 100) / 10) {
                count++;
            }
        }
        System.out.println(count);
    } main {
        Scanner scanner = new Scanner(System.in);
        String[] ab = scanner.nextLine().split(" ", 2);
        int a = Integer.parseInt(ab[0]);
        int b = Integer.parseInt(ab[1]);

        int count = 0;
        for (int i = a; i <= b; i++) {
            if (i / 10000 == i % 10 && (i % 10000) / 1000 == (i % 100) / 10) {
                count++;
            }
        }
        System.out.println(count);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String[] ab = scanner.nextLine().split(" ", 2); ab scanner.nextLine().split(" ", 2) scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " 2 int a = Integer.parseInt(ab[0]); a Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 int b = Integer.parseInt(ab[1]); b Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 int count = 0; count 0 for (int i = a; i <= b; i++) {
            if (i / 10000 == i % 10 && (i % 10000) / 1000 == (i % 100) / 10) {
                count++;
            }
        } int i = a; int i = a; i a i <= b i b i++ i++ i {
            if (i / 10000 == i % 10 && (i % 10000) / 1000 == (i % 100) / 10) {
                count++;
            }
        } {
            if (i / 10000 == i % 10 && (i % 10000) / 1000 == (i % 100) / 10) {
                count++;
            }
        } if (i / 10000 == i % 10 && (i % 10000) / 1000 == (i % 100) / 10) {
                count++;
            } i / 10000 == i % 10 && (i % 10000) / 1000 == (i % 100) / 10 i / 10000 == i % 10 i / 10000 i 10000 i % 10 i 10 (i % 10000) / 1000 == (i % 100) / 10 (i % 10000) / 1000 (i % 10000) i 10000 1000 (i % 100) / 10 (i % 100) i 100 10 {
                count++;
            } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] ab = scanner.nextLine().split(" ", 2);
        int a = Integer.parseInt(ab[0]);
        int b = Integer.parseInt(ab[1]);

        int count = 0;
        for (int i = a; i <= b; i++) {
            if (i / 10000 == i % 10 && (i % 10000) / 1000 == (i % 100) / 10) {
                count++;
            }
        }
        System.out.println(count);
    }
}
