import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = 0;
        for (int i = a; i <= b; i++) {
            String tmp = Integer.toString(i);
            if(tmp.substring(0, 1).equals(tmp.substring(4, 5)) &&
                    tmp.substring(1, 2).equals(tmp.substring(3, 4))) {
                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);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = 0;
        for (int i = a; i <= b; i++) {
            String tmp = Integer.toString(i);
            if(tmp.substring(0, 1).equals(tmp.substring(4, 5)) &&
                    tmp.substring(1, 2).equals(tmp.substring(3, 4))) {
                ans++;
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = 0;
        for (int i = a; i <= b; i++) {
            String tmp = Integer.toString(i);
            if(tmp.substring(0, 1).equals(tmp.substring(4, 5)) &&
                    tmp.substring(1, 2).equals(tmp.substring(3, 4))) {
                ans++;
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = 0;
        for (int i = a; i <= b; i++) {
            String tmp = Integer.toString(i);
            if(tmp.substring(0, 1).equals(tmp.substring(4, 5)) &&
                    tmp.substring(1, 2).equals(tmp.substring(3, 4))) {
                ans++;
            }
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int ans = 0; ans 0 for (int i = a; i <= b; i++) {
            String tmp = Integer.toString(i);
            if(tmp.substring(0, 1).equals(tmp.substring(4, 5)) &&
                    tmp.substring(1, 2).equals(tmp.substring(3, 4))) {
                ans++;
            }
        } int i = a; int i = a; i a i <= b i b i++ i++ i {
            String tmp = Integer.toString(i);
            if(tmp.substring(0, 1).equals(tmp.substring(4, 5)) &&
                    tmp.substring(1, 2).equals(tmp.substring(3, 4))) {
                ans++;
            }
        } {
            String tmp = Integer.toString(i);
            if(tmp.substring(0, 1).equals(tmp.substring(4, 5)) &&
                    tmp.substring(1, 2).equals(tmp.substring(3, 4))) {
                ans++;
            }
        } String tmp = Integer.toString(i); tmp Integer.toString(i) Integer.toString Integer i if(tmp.substring(0, 1).equals(tmp.substring(4, 5)) &&
                    tmp.substring(1, 2).equals(tmp.substring(3, 4))) {
                ans++;
            } tmp.substring(0, 1).equals(tmp.substring(4, 5)) &&
                    tmp.substring(1, 2).equals(tmp.substring(3, 4)) tmp.substring(0, 1).equals(tmp.substring(4, 5)) tmp.substring(0, 1).equals tmp.substring(0, 1) tmp.substring tmp 0 1 tmp.substring(4, 5) tmp.substring tmp 4 5 tmp.substring(1, 2).equals(tmp.substring(3, 4)) tmp.substring(1, 2).equals tmp.substring(1, 2) tmp.substring tmp 1 2 tmp.substring(3, 4) tmp.substring tmp 3 4 {
                ans++;
            } 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);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = 0;
        for (int i = a; i <= b; i++) {
            String tmp = Integer.toString(i);
            if(tmp.substring(0, 1).equals(tmp.substring(4, 5)) &&
                    tmp.substring(1, 2).equals(tmp.substring(3, 4))) {
                ans++;
            }
        }
        System.out.println(ans);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = 0;
        for (int i = a; i <= b; i++) {
            String tmp = Integer.toString(i);
            if(tmp.substring(0, 1).equals(tmp.substring(4, 5)) &&
                    tmp.substring(1, 2).equals(tmp.substring(3, 4))) {
                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);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = 0;
        for (int i = a; i <= b; i++) {
            String tmp = Integer.toString(i);
            if(tmp.substring(0, 1).equals(tmp.substring(4, 5)) &&
                    tmp.substring(1, 2).equals(tmp.substring(3, 4))) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}