import java.util.*;

class Main{
    static int Palindromic(int n){
        int ans;
        int[] t = new int[5];
        for(int i = 0; i < 5; i++){
            t[i] =  n % 10;
            n /= 10;
        }
        ans = 10000 * t[0] + 1000 * t[1] + 100 * t[2] + 10* t[3] + t[4];
        return ans;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        int count = 0;
        for(int i = A; i <= B; i++){
            if(i == Palindromic(i)) count++;
        }

        System.out.println(count);
    }
} import java.util.*; util.* java class Main{
    static int Palindromic(int n){
        int ans;
        int[] t = new int[5];
        for(int i = 0; i < 5; i++){
            t[i] =  n % 10;
            n /= 10;
        }
        ans = 10000 * t[0] + 1000 * t[1] + 100 * t[2] + 10* t[3] + t[4];
        return ans;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        int count = 0;
        for(int i = A; i <= B; i++){
            if(i == Palindromic(i)) count++;
        }

        System.out.println(count);
    }
} Main static int Palindromic(int n){
        int ans;
        int[] t = new int[5];
        for(int i = 0; i < 5; i++){
            t[i] =  n % 10;
            n /= 10;
        }
        ans = 10000 * t[0] + 1000 * t[1] + 100 * t[2] + 10* t[3] + t[4];
        return ans;
    } Palindromic {
        int ans;
        int[] t = new int[5];
        for(int i = 0; i < 5; i++){
            t[i] =  n % 10;
            n /= 10;
        }
        ans = 10000 * t[0] + 1000 * t[1] + 100 * t[2] + 10* t[3] + t[4];
        return ans;
    } int ans; ans int[] t = new int[5]; t new int[5] 5 for(int i = 0; i < 5; i++){
            t[i] =  n % 10;
            n /= 10;
        } int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
            t[i] =  n % 10;
            n /= 10;
        } {
            t[i] =  n % 10;
            n /= 10;
        } t[i] =  n % 10 t[i] t i n % 10 n 10 n /= 10 n 10 ans = 10000 * t[0] + 1000 * t[1] + 100 * t[2] + 10* t[3] + t[4] ans 10000 * t[0] + 1000 * t[1] + 100 * t[2] + 10* t[3] + t[4] 10* t[3] 100 * t[2] 10000 * t[0] + 1000 * t[1] + 100 * t[2] + 10* t[3] + t[4] 10000 * t[0] 10000 t[0] t 0 1000 * t[1] 1000 t[1] t 1 100 * t[2] 100 t[2] t 2 10* t[3] 10 t[3] t 3 t[4] t 4 return ans; ans int n n public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        int count = 0;
        for(int i = A; i <= B; i++){
            if(i == Palindromic(i)) count++;
        }

        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        int count = 0;
        for(int i = A; i <= B; i++){
            if(i == Palindromic(i)) count++;
        }

        System.out.println(count);
    } 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 count = 0; count 0 for(int i = A; i <= B; i++){
            if(i == Palindromic(i)) count++;
        } int i = A; int i = A; i A i <= B i B i++ i++ i {
            if(i == Palindromic(i)) count++;
        } {
            if(i == Palindromic(i)) count++;
        } if(i == Palindromic(i)) count++; i == Palindromic(i) i Palindromic(i) Palindromic i count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.*;

class Main{
    static int Palindromic(int n){
        int ans;
        int[] t = new int[5];
        for(int i = 0; i < 5; i++){
            t[i] =  n % 10;
            n /= 10;
        }
        ans = 10000 * t[0] + 1000 * t[1] + 100 * t[2] + 10* t[3] + t[4];
        return ans;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        int count = 0;
        for(int i = A; i <= B; i++){
            if(i == Palindromic(i)) count++;
        }

        System.out.println(count);
    }
}