import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        final int A = sc.nextInt();
        final int B = sc.nextInt();

        int ans = 0;
        for (int i = A; i <= B; i++) {
            int q = i / 10000 % 10;
            int w = i / 1000 % 10;
            int r = i / 10 % 10;
            int t = i % 10;
            if (q == t && w == r) ans++;
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        final int A = sc.nextInt();
        final int B = sc.nextInt();

        int ans = 0;
        for (int i = A; i <= B; i++) {
            int q = i / 10000 % 10;
            int w = i / 1000 % 10;
            int r = i / 10 % 10;
            int t = i % 10;
            if (q == t && w == r) ans++;
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        final int A = sc.nextInt();
        final int B = sc.nextInt();

        int ans = 0;
        for (int i = A; i <= B; i++) {
            int q = i / 10000 % 10;
            int w = i / 1000 % 10;
            int r = i / 10 % 10;
            int t = i % 10;
            if (q == t && w == r) ans++;
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);

        final int A = sc.nextInt();
        final int B = sc.nextInt();

        int ans = 0;
        for (int i = A; i <= B; i++) {
            int q = i / 10000 % 10;
            int w = i / 1000 % 10;
            int r = i / 10 % 10;
            int t = i % 10;
            if (q == t && w == r) ans++;
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc final int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc int ans = 0; ans 0 for (int i = A; i <= B; i++) {
            int q = i / 10000 % 10;
            int w = i / 1000 % 10;
            int r = i / 10 % 10;
            int t = i % 10;
            if (q == t && w == r) ans++;
        } int i = A; int i = A; i A i <= B i B i++ i++ i {
            int q = i / 10000 % 10;
            int w = i / 1000 % 10;
            int r = i / 10 % 10;
            int t = i % 10;
            if (q == t && w == r) ans++;
        } {
            int q = i / 10000 % 10;
            int w = i / 1000 % 10;
            int r = i / 10 % 10;
            int t = i % 10;
            if (q == t && w == r) ans++;
        } int q = i / 10000 % 10; q i / 10000 % 10 i / 10000 i 10000 10 int w = i / 1000 % 10; w i / 1000 % 10 i / 1000 i 1000 10 int r = i / 10 % 10; r i / 10 % 10 i / 10 i 10 10 int t = i % 10; t i % 10 i 10 if (q == t && w == r) ans++; q == t && w == r q == t q t w == r w r ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        final int A = sc.nextInt();
        final int B = sc.nextInt();

        int ans = 0;
        for (int i = A; i <= B; i++) {
            int q = i / 10000 % 10;
            int w = i / 1000 % 10;
            int r = i / 10 % 10;
            int t = i % 10;
            if (q == t && w == r) ans++;
        }
        System.out.println(ans);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        final int A = sc.nextInt();
        final int B = sc.nextInt();

        int ans = 0;
        for (int i = A; i <= B; i++) {
            int q = i / 10000 % 10;
            int w = i / 1000 % 10;
            int r = i / 10 % 10;
            int t = i % 10;
            if (q == t && w == r) ans++;
        }
        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        final int A = sc.nextInt();
        final int B = sc.nextInt();

        int ans = 0;
        for (int i = A; i <= B; i++) {
            int q = i / 10000 % 10;
            int w = i / 1000 % 10;
            int r = i / 10 % 10;
            int t = i % 10;
            if (q == t && w == r) ans++;
        }
        System.out.println(ans);
    }
}
