import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    }

    void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b; i++) {
            char[] tmp = String.valueOf(i).toCharArray();
            if (tmp[0] == tmp[4] && tmp[1] == tmp[3]) {
                count++;
            }
        }
        System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    }

    void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b; i++) {
            char[] tmp = String.valueOf(i).toCharArray();
            if (tmp[0] == tmp[4] && tmp[1] == tmp[3]) {
                count++;
            }
        }
        System.out.println(count);
    }
} Main public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    } main {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    } try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        } {
            new Main().solve(sc);
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) new Main().solve(sc) new Main().solve new Main() sc String[] args args void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b; i++) {
            char[] tmp = String.valueOf(i).toCharArray();
            if (tmp[0] == tmp[4] && tmp[1] == tmp[3]) {
                count++;
            }
        }
        System.out.println(count);
    } solve {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b; i++) {
            char[] tmp = String.valueOf(i).toCharArray();
            if (tmp[0] == tmp[4] && tmp[1] == tmp[3]) {
                count++;
            }
        }
        System.out.println(count);
    } int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int count = 0; count 0 for (int i = a; i <= b; i++) {
            char[] tmp = String.valueOf(i).toCharArray();
            if (tmp[0] == tmp[4] && tmp[1] == tmp[3]) {
                count++;
            }
        } int i = a; int i = a; i a i <= b i b i++ i++ i {
            char[] tmp = String.valueOf(i).toCharArray();
            if (tmp[0] == tmp[4] && tmp[1] == tmp[3]) {
                count++;
            }
        } {
            char[] tmp = String.valueOf(i).toCharArray();
            if (tmp[0] == tmp[4] && tmp[1] == tmp[3]) {
                count++;
            }
        } char[] tmp = String.valueOf(i).toCharArray(); tmp String.valueOf(i).toCharArray() String.valueOf(i).toCharArray String.valueOf(i) String.valueOf String i if (tmp[0] == tmp[4] && tmp[1] == tmp[3]) {
                count++;
            } tmp[0] == tmp[4] && tmp[1] == tmp[3] tmp[0] == tmp[4] tmp[0] tmp 0 tmp[4] tmp 4 tmp[1] == tmp[3] tmp[1] tmp 1 tmp[3] tmp 3 {
                count++;
            } count++ count System.out.println(count) System.out.println System.out System System.out count Scanner sc sc public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    }

    void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b; i++) {
            char[] tmp = String.valueOf(i).toCharArray();
            if (tmp[0] == tmp[4] && tmp[1] == tmp[3]) {
                count++;
            }
        }
        System.out.println(count);
    }
} public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    }

    void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b; i++) {
            char[] tmp = String.valueOf(i).toCharArray();
            if (tmp[0] == tmp[4] && tmp[1] == tmp[3]) {
                count++;
            }
        }
        System.out.println(count);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    }

    void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b; i++) {
            char[] tmp = String.valueOf(i).toCharArray();
            if (tmp[0] == tmp[4] && tmp[1] == tmp[3]) {
                count++;
            }
        }
        System.out.println(count);
    }
}