import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner Input = new Scanner(System.in);
        String A = Input.next();
        String B = Input.next();
        int Count = 0;
        for (int I = Integer.parseInt(A); I <= Integer.parseInt(B); I++) {
            String J = I + "";
            if (J.charAt(0) == J.charAt(4) && J.charAt(1) == J.charAt(3)) {Count++;}}System.out.println(Count);}} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner Input = new Scanner(System.in);
        String A = Input.next();
        String B = Input.next();
        int Count = 0;
        for (int I = Integer.parseInt(A); I <= Integer.parseInt(B); I++) {
            String J = I + "";
            if (J.charAt(0) == J.charAt(4) && J.charAt(1) == J.charAt(3)) {Count++;}}System.out.println(Count);}} Main public static void main(String[] args) {
        Scanner Input = new Scanner(System.in);
        String A = Input.next();
        String B = Input.next();
        int Count = 0;
        for (int I = Integer.parseInt(A); I <= Integer.parseInt(B); I++) {
            String J = I + "";
            if (J.charAt(0) == J.charAt(4) && J.charAt(1) == J.charAt(3)) {Count++;}}System.out.println(Count);} main {
        Scanner Input = new Scanner(System.in);
        String A = Input.next();
        String B = Input.next();
        int Count = 0;
        for (int I = Integer.parseInt(A); I <= Integer.parseInt(B); I++) {
            String J = I + "";
            if (J.charAt(0) == J.charAt(4) && J.charAt(1) == J.charAt(3)) {Count++;}}System.out.println(Count);} Scanner Input = new Scanner(System.in); Input new Scanner(System.in) String A = Input.next(); A Input.next() Input.next Input String B = Input.next(); B Input.next() Input.next Input int Count = 0; Count 0 for (int I = Integer.parseInt(A); I <= Integer.parseInt(B); I++) {
            String J = I + "";
            if (J.charAt(0) == J.charAt(4) && J.charAt(1) == J.charAt(3)) {Count++;}} int I = Integer.parseInt(A); int I = Integer.parseInt(A); I Integer.parseInt(A) Integer.parseInt Integer A I <= Integer.parseInt(B) I Integer.parseInt(B) Integer.parseInt Integer B I++ I++ I {
            String J = I + "";
            if (J.charAt(0) == J.charAt(4) && J.charAt(1) == J.charAt(3)) {Count++;}} {
            String J = I + "";
            if (J.charAt(0) == J.charAt(4) && J.charAt(1) == J.charAt(3)) {Count++;}} String J = I + ""; J I + "" I "" if (J.charAt(0) == J.charAt(4) && J.charAt(1) == J.charAt(3)) {Count++;} J.charAt(0) == J.charAt(4) && J.charAt(1) == J.charAt(3) J.charAt(0) == J.charAt(4) J.charAt(0) J.charAt J 0 J.charAt(4) J.charAt J 4 J.charAt(1) == J.charAt(3) J.charAt(1) J.charAt J 1 J.charAt(3) J.charAt J 3 {Count++;} Count++ Count System.out.println(Count) System.out.println System.out System System.out Count String[] args args public class Main {
    public static void main(String[] args) {
        Scanner Input = new Scanner(System.in);
        String A = Input.next();
        String B = Input.next();
        int Count = 0;
        for (int I = Integer.parseInt(A); I <= Integer.parseInt(B); I++) {
            String J = I + "";
            if (J.charAt(0) == J.charAt(4) && J.charAt(1) == J.charAt(3)) {Count++;}}System.out.println(Count);}} public class Main {
    public static void main(String[] args) {
        Scanner Input = new Scanner(System.in);
        String A = Input.next();
        String B = Input.next();
        int Count = 0;
        for (int I = Integer.parseInt(A); I <= Integer.parseInt(B); I++) {
            String J = I + "";
            if (J.charAt(0) == J.charAt(4) && J.charAt(1) == J.charAt(3)) {Count++;}}System.out.println(Count);}} Main
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner Input = new Scanner(System.in);
        String A = Input.next();
        String B = Input.next();
        int Count = 0;
        for (int I = Integer.parseInt(A); I <= Integer.parseInt(B); I++) {
            String J = I + "";
            if (J.charAt(0) == J.charAt(4) && J.charAt(1) == J.charAt(3)) {Count++;}}System.out.println(Count);}}