import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt();
        int ans = 0;
        for(int i = a; i <= b; i++){
            int v = i % 10;
            int w = (i - v) / 10 % 10;
            int x = (i - w - v)  / 100 % 10;
            int y = (i - x - w - v) / 1000 % 10;
            int z = (i - y - x - w - v) / 10000 % 10;
            if(v == z && w == y) ans++;
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt();
        int ans = 0;
        for(int i = a; i <= b; i++){
            int v = i % 10;
            int w = (i - v) / 10 % 10;
            int x = (i - w - v)  / 100 % 10;
            int y = (i - x - w - v) / 1000 % 10;
            int z = (i - y - x - w - v) / 10000 % 10;
            if(v == z && w == y) ans++;
        }
        System.out.println(ans);
    }
} Main public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt();
        int ans = 0;
        for(int i = a; i <= b; i++){
            int v = i % 10;
            int w = (i - v) / 10 % 10;
            int x = (i - w - v)  / 100 % 10;
            int y = (i - x - w - v) / 1000 % 10;
            int z = (i - y - x - w - v) / 10000 % 10;
            if(v == z && w == y) ans++;
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt();
        int ans = 0;
        for(int i = a; i <= b; i++){
            int v = i % 10;
            int w = (i - v) / 10 % 10;
            int x = (i - w - v)  / 100 % 10;
            int y = (i - x - w - v) / 1000 % 10;
            int z = (i - y - x - w - v) / 10000 % 10;
            if(v == z && w == y) 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 b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int ans = 0; ans 0 for(int i = a; i <= b; i++){
            int v = i % 10;
            int w = (i - v) / 10 % 10;
            int x = (i - w - v)  / 100 % 10;
            int y = (i - x - w - v) / 1000 % 10;
            int z = (i - y - x - w - v) / 10000 % 10;
            if(v == z && w == y) ans++;
        } int i = a; int i = a; i a i <= b i b i++ i++ i {
            int v = i % 10;
            int w = (i - v) / 10 % 10;
            int x = (i - w - v)  / 100 % 10;
            int y = (i - x - w - v) / 1000 % 10;
            int z = (i - y - x - w - v) / 10000 % 10;
            if(v == z && w == y) ans++;
        } {
            int v = i % 10;
            int w = (i - v) / 10 % 10;
            int x = (i - w - v)  / 100 % 10;
            int y = (i - x - w - v) / 1000 % 10;
            int z = (i - y - x - w - v) / 10000 % 10;
            if(v == z && w == y) ans++;
        } int v = i % 10; v i % 10 i 10 int w = (i - v) / 10 % 10; w (i - v) / 10 % 10 (i - v) / 10 (i - v) i v 10 10 int x = (i - w - v)  / 100 % 10; x (i - w - v)  / 100 % 10 (i - w - v)  / 100 (i - w - v) i - w - v i w v 100 10 int y = (i - x - w - v) / 1000 % 10; y (i - x - w - v) / 1000 % 10 (i - x - w - v) / 1000 (i - x - w - v) w i - x - w - v i x w v 1000 10 int z = (i - y - x - w - v) / 10000 % 10; z (i - y - x - w - v) / 10000 % 10 (i - y - x - w - v) / 10000 (i - y - x - w - v) w x i - y - x - w - v i y x w v 10000 10 if(v == z && w == y) ans++; v == z && w == y v == z v z w == y w y ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt();
        int ans = 0;
        for(int i = a; i <= b; i++){
            int v = i % 10;
            int w = (i - v) / 10 % 10;
            int x = (i - w - v)  / 100 % 10;
            int y = (i - x - w - v) / 1000 % 10;
            int z = (i - y - x - w - v) / 10000 % 10;
            if(v == z && w == y) ans++;
        }
        System.out.println(ans);
    }
}