import java.util.Scanner;

public class Main {

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

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

        int ans = 0;

        for (int x = A; x <= B; x++) {
            char[] cs = String.valueOf(x).toCharArray();
            if (cs[0] == cs[4] && cs[1] == cs[3]) {
                ans++;
            }
        }

        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {

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

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

        int ans = 0;

        for (int x = A; x <= B; x++) {
            char[] cs = String.valueOf(x).toCharArray();
            if (cs[0] == cs[4] && cs[1] == cs[3]) {
                ans++;
            }
        }

        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

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

        int ans = 0;

        for (int x = A; x <= B; x++) {
            char[] cs = String.valueOf(x).toCharArray();
            if (cs[0] == cs[4] && cs[1] == cs[3]) {
                ans++;
            }
        }

        System.out.println(ans);
    } main {
        final Scanner sc = new Scanner(System.in);

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

        int ans = 0;

        for (int x = A; x <= B; x++) {
            char[] cs = String.valueOf(x).toCharArray();
            if (cs[0] == cs[4] && cs[1] == cs[3]) {
                ans++;
            }
        }

        System.out.println(ans);
    } final 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 x = A; x <= B; x++) {
            char[] cs = String.valueOf(x).toCharArray();
            if (cs[0] == cs[4] && cs[1] == cs[3]) {
                ans++;
            }
        } int x = A; int x = A; x A x <= B x B x++ x++ x {
            char[] cs = String.valueOf(x).toCharArray();
            if (cs[0] == cs[4] && cs[1] == cs[3]) {
                ans++;
            }
        } {
            char[] cs = String.valueOf(x).toCharArray();
            if (cs[0] == cs[4] && cs[1] == cs[3]) {
                ans++;
            }
        } char[] cs = String.valueOf(x).toCharArray(); cs String.valueOf(x).toCharArray() String.valueOf(x).toCharArray String.valueOf(x) String.valueOf String x if (cs[0] == cs[4] && cs[1] == cs[3]) {
                ans++;
            } cs[0] == cs[4] && cs[1] == cs[3] cs[0] == cs[4] cs[0] cs 0 cs[4] cs 4 cs[1] == cs[3] cs[1] cs 1 cs[3] cs 3 {
                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) {
        final Scanner sc = new Scanner(System.in);

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

        int ans = 0;

        for (int x = A; x <= B; x++) {
            char[] cs = String.valueOf(x).toCharArray();
            if (cs[0] == cs[4] && cs[1] == cs[3]) {
                ans++;
            }
        }

        System.out.println(ans);
    }
} public class Main {

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

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

        int ans = 0;

        for (int x = A; x <= B; x++) {
            char[] cs = String.valueOf(x).toCharArray();
            if (cs[0] == cs[4] && cs[1] == cs[3]) {
                ans++;
            }
        }

        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main {

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

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

        int ans = 0;

        for (int x = A; x <= B; x++) {
            char[] cs = String.valueOf(x).toCharArray();
            if (cs[0] == cs[4] && cs[1] == cs[3]) {
                ans++;
            }
        }

        System.out.println(ans);
    }
}
