import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());

        int cnt = 0;

        for(int i = a; i <= b; i++){
            String s = String.valueOf(i);
            char[] c = s.toCharArray();
            if(c[0] == c[4] && c[1] == c[3]){
                cnt ++;
            }
        }

        System.out.println(cnt);
        
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());

        int cnt = 0;

        for(int i = a; i <= b; i++){
            String s = String.valueOf(i);
            char[] c = s.toCharArray();
            if(c[0] == c[4] && c[1] == c[3]){
                cnt ++;
            }
        }

        System.out.println(cnt);
        
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());

        int cnt = 0;

        for(int i = a; i <= b; i++){
            String s = String.valueOf(i);
            char[] c = s.toCharArray();
            if(c[0] == c[4] && c[1] == c[3]){
                cnt ++;
            }
        }

        System.out.println(cnt);
        
    } main {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());

        int cnt = 0;

        for(int i = a; i <= b; i++){
            String s = String.valueOf(i);
            char[] c = s.toCharArray();
            if(c[0] == c[4] && c[1] == c[3]){
                cnt ++;
            }
        }

        System.out.println(cnt);
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = Integer.parseInt(sc.next()); a Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int b = Integer.parseInt(sc.next()); b Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int cnt = 0; cnt 0 for(int i = a; i <= b; i++){
            String s = String.valueOf(i);
            char[] c = s.toCharArray();
            if(c[0] == c[4] && c[1] == c[3]){
                cnt ++;
            }
        } int i = a; int i = a; i a i <= b i b i++ i++ i {
            String s = String.valueOf(i);
            char[] c = s.toCharArray();
            if(c[0] == c[4] && c[1] == c[3]){
                cnt ++;
            }
        } {
            String s = String.valueOf(i);
            char[] c = s.toCharArray();
            if(c[0] == c[4] && c[1] == c[3]){
                cnt ++;
            }
        } String s = String.valueOf(i); s String.valueOf(i) String.valueOf String i char[] c = s.toCharArray(); c s.toCharArray() s.toCharArray s if(c[0] == c[4] && c[1] == c[3]){
                cnt ++;
            } c[0] == c[4] && c[1] == c[3] c[0] == c[4] c[0] c 0 c[4] c 4 c[1] == c[3] c[1] c 1 c[3] c 3 {
                cnt ++;
            } cnt ++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());

        int cnt = 0;

        for(int i = a; i <= b; i++){
            String s = String.valueOf(i);
            char[] c = s.toCharArray();
            if(c[0] == c[4] && c[1] == c[3]){
                cnt ++;
            }
        }

        System.out.println(cnt);
        
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());

        int cnt = 0;

        for(int i = a; i <= b; i++){
            String s = String.valueOf(i);
            char[] c = s.toCharArray();
            if(c[0] == c[4] && c[1] == c[3]){
                cnt ++;
            }
        }

        System.out.println(cnt);
        
    }
} Main
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());

        int cnt = 0;

        for(int i = a; i <= b; i++){
            String s = String.valueOf(i);
            char[] c = s.toCharArray();
            if(c[0] == c[4] && c[1] == c[3]){
                cnt ++;
            }
        }

        System.out.println(cnt);
        
    }
}