import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
        
        int a = scan.nextInt();
        int b = scan.nextInt();
        int cnt = 0;

        for(int i=a; i<=b; i++){
            String sa = String.valueOf(i);
            if(sa.substring(0, 1).equals(sa.substring(4, 5)) 
                && sa.substring(1, 2).equals(sa.substring(3, 4))){
                    cnt++;
                }
        }

        System.out.println(cnt);

        scan.close();
    
    }

} import java.util.Scanner; Scanner java.util public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
        
        int a = scan.nextInt();
        int b = scan.nextInt();
        int cnt = 0;

        for(int i=a; i<=b; i++){
            String sa = String.valueOf(i);
            if(sa.substring(0, 1).equals(sa.substring(4, 5)) 
                && sa.substring(1, 2).equals(sa.substring(3, 4))){
                    cnt++;
                }
        }

        System.out.println(cnt);

        scan.close();
    
    }

} Main public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
        
        int a = scan.nextInt();
        int b = scan.nextInt();
        int cnt = 0;

        for(int i=a; i<=b; i++){
            String sa = String.valueOf(i);
            if(sa.substring(0, 1).equals(sa.substring(4, 5)) 
                && sa.substring(1, 2).equals(sa.substring(3, 4))){
                    cnt++;
                }
        }

        System.out.println(cnt);

        scan.close();
    
    } main {
        
        Scanner scan = new Scanner(System.in);
        
        int a = scan.nextInt();
        int b = scan.nextInt();
        int cnt = 0;

        for(int i=a; i<=b; i++){
            String sa = String.valueOf(i);
            if(sa.substring(0, 1).equals(sa.substring(4, 5)) 
                && sa.substring(1, 2).equals(sa.substring(3, 4))){
                    cnt++;
                }
        }

        System.out.println(cnt);

        scan.close();
    
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int a = scan.nextInt(); a scan.nextInt() scan.nextInt scan int b = scan.nextInt(); b scan.nextInt() scan.nextInt scan int cnt = 0; cnt 0 for(int i=a; i<=b; i++){
            String sa = String.valueOf(i);
            if(sa.substring(0, 1).equals(sa.substring(4, 5)) 
                && sa.substring(1, 2).equals(sa.substring(3, 4))){
                    cnt++;
                }
        } int i=a; int i=a; i a i<=b i b i++ i++ i {
            String sa = String.valueOf(i);
            if(sa.substring(0, 1).equals(sa.substring(4, 5)) 
                && sa.substring(1, 2).equals(sa.substring(3, 4))){
                    cnt++;
                }
        } {
            String sa = String.valueOf(i);
            if(sa.substring(0, 1).equals(sa.substring(4, 5)) 
                && sa.substring(1, 2).equals(sa.substring(3, 4))){
                    cnt++;
                }
        } String sa = String.valueOf(i); sa String.valueOf(i) String.valueOf String i if(sa.substring(0, 1).equals(sa.substring(4, 5)) 
                && sa.substring(1, 2).equals(sa.substring(3, 4))){
                    cnt++;
                } sa.substring(0, 1).equals(sa.substring(4, 5)) 
                && sa.substring(1, 2).equals(sa.substring(3, 4)) sa.substring(0, 1).equals(sa.substring(4, 5)) sa.substring(0, 1).equals sa.substring(0, 1) sa.substring sa 0 1 sa.substring(4, 5) sa.substring sa 4 5 sa.substring(1, 2).equals(sa.substring(3, 4)) sa.substring(1, 2).equals sa.substring(1, 2) sa.substring sa 1 2 sa.substring(3, 4) sa.substring sa 3 4 {
                    cnt++;
                } cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt scan.close() scan.close scan String[] args args public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
        
        int a = scan.nextInt();
        int b = scan.nextInt();
        int cnt = 0;

        for(int i=a; i<=b; i++){
            String sa = String.valueOf(i);
            if(sa.substring(0, 1).equals(sa.substring(4, 5)) 
                && sa.substring(1, 2).equals(sa.substring(3, 4))){
                    cnt++;
                }
        }

        System.out.println(cnt);

        scan.close();
    
    }

} public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
        
        int a = scan.nextInt();
        int b = scan.nextInt();
        int cnt = 0;

        for(int i=a; i<=b; i++){
            String sa = String.valueOf(i);
            if(sa.substring(0, 1).equals(sa.substring(4, 5)) 
                && sa.substring(1, 2).equals(sa.substring(3, 4))){
                    cnt++;
                }
        }

        System.out.println(cnt);

        scan.close();
    
    }

} Main
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
        
        int a = scan.nextInt();
        int b = scan.nextInt();
        int cnt = 0;

        for(int i=a; i<=b; i++){
            String sa = String.valueOf(i);
            if(sa.substring(0, 1).equals(sa.substring(4, 5)) 
                && sa.substring(1, 2).equals(sa.substring(3, 4))){
                    cnt++;
                }
        }

        System.out.println(cnt);

        scan.close();
    
    }

}