import java.util.Scanner;

public class Main {
    public static void main(String... args){
        Scanner sc = new Scanner(System.in);
        String[] str = sc.nextLine().split(" ");
        int start = Integer.parseInt(str[0]);
        int end = Integer.parseInt(str[1]);
        int ans = 0;
        for(int i = start; i <= end; i++){
            if(isValid(i)){
                ans++;
            }
        }
        System.out.println(ans);
    }
    
    static boolean isValid(int num){
        int digit1 = num % 10;
        int tmp2 = num - digit1;
        int digit2 = tmp2/10 % 10;
        int tmp3 = tmp2 - digit2 * 10;
        int digit3 = tmp3/100 % 10;
        int tmp4 = tmp3 - digit3 * 100;
        int digit4 = tmp4/1000 % 10;
        int tmp5 = tmp4 - digit4 * 1000;
        int digit5 = tmp5/10000 % 10;
        if(digit1 == digit5 & digit2 == digit4){
            return true;
        }else{
            return false;
        }
    }
   
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String... args){
        Scanner sc = new Scanner(System.in);
        String[] str = sc.nextLine().split(" ");
        int start = Integer.parseInt(str[0]);
        int end = Integer.parseInt(str[1]);
        int ans = 0;
        for(int i = start; i <= end; i++){
            if(isValid(i)){
                ans++;
            }
        }
        System.out.println(ans);
    }
    
    static boolean isValid(int num){
        int digit1 = num % 10;
        int tmp2 = num - digit1;
        int digit2 = tmp2/10 % 10;
        int tmp3 = tmp2 - digit2 * 10;
        int digit3 = tmp3/100 % 10;
        int tmp4 = tmp3 - digit3 * 100;
        int digit4 = tmp4/1000 % 10;
        int tmp5 = tmp4 - digit4 * 1000;
        int digit5 = tmp5/10000 % 10;
        if(digit1 == digit5 & digit2 == digit4){
            return true;
        }else{
            return false;
        }
    }
   
} Main public static void main(String... args){
        Scanner sc = new Scanner(System.in);
        String[] str = sc.nextLine().split(" ");
        int start = Integer.parseInt(str[0]);
        int end = Integer.parseInt(str[1]);
        int ans = 0;
        for(int i = start; i <= end; i++){
            if(isValid(i)){
                ans++;
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        String[] str = sc.nextLine().split(" ");
        int start = Integer.parseInt(str[0]);
        int end = Integer.parseInt(str[1]);
        int ans = 0;
        for(int i = start; i <= end; i++){
            if(isValid(i)){
                ans++;
            }
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] str = sc.nextLine().split(" "); str sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int start = Integer.parseInt(str[0]); start Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 int end = Integer.parseInt(str[1]); end Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 int ans = 0; ans 0 for(int i = start; i <= end; i++){
            if(isValid(i)){
                ans++;
            }
        } int i = start; int i = start; i start i <= end i end i++ i++ i {
            if(isValid(i)){
                ans++;
            }
        } {
            if(isValid(i)){
                ans++;
            }
        } if(isValid(i)){
                ans++;
            } isValid(i) isValid i {
                ans++;
            } ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String... args args static boolean isValid(int num){
        int digit1 = num % 10;
        int tmp2 = num - digit1;
        int digit2 = tmp2/10 % 10;
        int tmp3 = tmp2 - digit2 * 10;
        int digit3 = tmp3/100 % 10;
        int tmp4 = tmp3 - digit3 * 100;
        int digit4 = tmp4/1000 % 10;
        int tmp5 = tmp4 - digit4 * 1000;
        int digit5 = tmp5/10000 % 10;
        if(digit1 == digit5 & digit2 == digit4){
            return true;
        }else{
            return false;
        }
    } isValid {
        int digit1 = num % 10;
        int tmp2 = num - digit1;
        int digit2 = tmp2/10 % 10;
        int tmp3 = tmp2 - digit2 * 10;
        int digit3 = tmp3/100 % 10;
        int tmp4 = tmp3 - digit3 * 100;
        int digit4 = tmp4/1000 % 10;
        int tmp5 = tmp4 - digit4 * 1000;
        int digit5 = tmp5/10000 % 10;
        if(digit1 == digit5 & digit2 == digit4){
            return true;
        }else{
            return false;
        }
    } int digit1 = num % 10; digit1 num % 10 num 10 int tmp2 = num - digit1; tmp2 num - digit1 num digit1 int digit2 = tmp2/10 % 10; digit2 tmp2/10 % 10 tmp2/10 tmp2 10 10 int tmp3 = tmp2 - digit2 * 10; tmp3 tmp2 - digit2 * 10 tmp2 digit2 * 10 digit2 10 int digit3 = tmp3/100 % 10; digit3 tmp3/100 % 10 tmp3/100 tmp3 100 10 int tmp4 = tmp3 - digit3 * 100; tmp4 tmp3 - digit3 * 100 tmp3 digit3 * 100 digit3 100 int digit4 = tmp4/1000 % 10; digit4 tmp4/1000 % 10 tmp4/1000 tmp4 1000 10 int tmp5 = tmp4 - digit4 * 1000; tmp5 tmp4 - digit4 * 1000 tmp4 digit4 * 1000 digit4 1000 int digit5 = tmp5/10000 % 10; digit5 tmp5/10000 % 10 tmp5/10000 tmp5 10000 10 if(digit1 == digit5 & digit2 == digit4){
            return true;
        }else{
            return false;
        } digit1 == digit5 & digit2 == digit4 digit1 == digit5 digit1 digit5 digit2 == digit4 digit2 digit4 {
            return true;
        } return true; true {
            return false;
        } return false; false int num num public class Main {
    public static void main(String... args){
        Scanner sc = new Scanner(System.in);
        String[] str = sc.nextLine().split(" ");
        int start = Integer.parseInt(str[0]);
        int end = Integer.parseInt(str[1]);
        int ans = 0;
        for(int i = start; i <= end; i++){
            if(isValid(i)){
                ans++;
            }
        }
        System.out.println(ans);
    }
    
    static boolean isValid(int num){
        int digit1 = num % 10;
        int tmp2 = num - digit1;
        int digit2 = tmp2/10 % 10;
        int tmp3 = tmp2 - digit2 * 10;
        int digit3 = tmp3/100 % 10;
        int tmp4 = tmp3 - digit3 * 100;
        int digit4 = tmp4/1000 % 10;
        int tmp5 = tmp4 - digit4 * 1000;
        int digit5 = tmp5/10000 % 10;
        if(digit1 == digit5 & digit2 == digit4){
            return true;
        }else{
            return false;
        }
    }
   
} public class Main {
    public static void main(String... args){
        Scanner sc = new Scanner(System.in);
        String[] str = sc.nextLine().split(" ");
        int start = Integer.parseInt(str[0]);
        int end = Integer.parseInt(str[1]);
        int ans = 0;
        for(int i = start; i <= end; i++){
            if(isValid(i)){
                ans++;
            }
        }
        System.out.println(ans);
    }
    
    static boolean isValid(int num){
        int digit1 = num % 10;
        int tmp2 = num - digit1;
        int digit2 = tmp2/10 % 10;
        int tmp3 = tmp2 - digit2 * 10;
        int digit3 = tmp3/100 % 10;
        int tmp4 = tmp3 - digit3 * 100;
        int digit4 = tmp4/1000 % 10;
        int tmp5 = tmp4 - digit4 * 1000;
        int digit5 = tmp5/10000 % 10;
        if(digit1 == digit5 & digit2 == digit4){
            return true;
        }else{
            return false;
        }
    }
   
} Main
import java.util.Scanner;

public class Main {
    public static void main(String... args){
        Scanner sc = new Scanner(System.in);
        String[] str = sc.nextLine().split(" ");
        int start = Integer.parseInt(str[0]);
        int end = Integer.parseInt(str[1]);
        int ans = 0;
        for(int i = start; i <= end; i++){
            if(isValid(i)){
                ans++;
            }
        }
        System.out.println(ans);
    }
    
    static boolean isValid(int num){
        int digit1 = num % 10;
        int tmp2 = num - digit1;
        int digit2 = tmp2/10 % 10;
        int tmp3 = tmp2 - digit2 * 10;
        int digit3 = tmp3/100 % 10;
        int tmp4 = tmp3 - digit3 * 100;
        int digit4 = tmp4/1000 % 10;
        int tmp5 = tmp4 - digit4 * 1000;
        int digit5 = tmp5/10000 % 10;
        if(digit1 == digit5 & digit2 == digit4){
            return true;
        }else{
            return false;
        }
    }
   
}
