import java.nio.file.*;
import java.nio.charset.*;
import java.util.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int p = 0;
        for(int i=a;i<b+1;i++){
            String str = String.valueOf(i);
            if(str.charAt(0) == str.charAt(4)
        && str.charAt(1) == str.charAt(3)){
                p += 1;
            }
        }
        System.out.println(p);
    }
} import java.nio.file.*; file.* java.nio import java.nio.charset.*; charset.* java.nio import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int p = 0;
        for(int i=a;i<b+1;i++){
            String str = String.valueOf(i);
            if(str.charAt(0) == str.charAt(4)
        && str.charAt(1) == str.charAt(3)){
                p += 1;
            }
        }
        System.out.println(p);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int p = 0;
        for(int i=a;i<b+1;i++){
            String str = String.valueOf(i);
            if(str.charAt(0) == str.charAt(4)
        && str.charAt(1) == str.charAt(3)){
                p += 1;
            }
        }
        System.out.println(p);
    } main {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int p = 0;
        for(int i=a;i<b+1;i++){
            String str = String.valueOf(i);
            if(str.charAt(0) == str.charAt(4)
        && str.charAt(1) == str.charAt(3)){
                p += 1;
            }
        }
        System.out.println(p);
    } 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 p = 0; p 0 for(int i=a;i<b+1;i++){
            String str = String.valueOf(i);
            if(str.charAt(0) == str.charAt(4)
        && str.charAt(1) == str.charAt(3)){
                p += 1;
            }
        } int i=a; int i=a; i a i<b+1 i b+1 b 1 i++ i++ i {
            String str = String.valueOf(i);
            if(str.charAt(0) == str.charAt(4)
        && str.charAt(1) == str.charAt(3)){
                p += 1;
            }
        } {
            String str = String.valueOf(i);
            if(str.charAt(0) == str.charAt(4)
        && str.charAt(1) == str.charAt(3)){
                p += 1;
            }
        } String str = String.valueOf(i); str String.valueOf(i) String.valueOf String i if(str.charAt(0) == str.charAt(4)
        && str.charAt(1) == str.charAt(3)){
                p += 1;
            } str.charAt(0) == str.charAt(4)
        && str.charAt(1) == str.charAt(3) str.charAt(0) == str.charAt(4) str.charAt(0) str.charAt str 0 str.charAt(4) str.charAt str 4 str.charAt(1) == str.charAt(3) str.charAt(1) str.charAt str 1 str.charAt(3) str.charAt str 3 {
                p += 1;
            } p += 1 p 1 System.out.println(p) System.out.println System.out System System.out p String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int p = 0;
        for(int i=a;i<b+1;i++){
            String str = String.valueOf(i);
            if(str.charAt(0) == str.charAt(4)
        && str.charAt(1) == str.charAt(3)){
                p += 1;
            }
        }
        System.out.println(p);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int p = 0;
        for(int i=a;i<b+1;i++){
            String str = String.valueOf(i);
            if(str.charAt(0) == str.charAt(4)
        && str.charAt(1) == str.charAt(3)){
                p += 1;
            }
        }
        System.out.println(p);
    }
} Main
import java.nio.file.*;
import java.nio.charset.*;
import java.util.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int p = 0;
        for(int i=a;i<b+1;i++){
            String str = String.valueOf(i);
            if(str.charAt(0) == str.charAt(4)
        && str.charAt(1) == str.charAt(3)){
                p += 1;
            }
        }
        System.out.println(p);
    }
}