import java.util.Scanner;
import java.util.Arrays;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int[] ans = new int[5];
        int count = 0;
        for(int i = A;i <= B;i++){
            int j = 0;
            int x = i;
            while(x > 0){
                ans[j++] = x % 10;
                x /= 10;
                //System.out.println("i = " + x);
                //System.out.println("ans[] = " + ans[j]);
            }
            if(ans[0] == ans[4] && ans[1] == ans[3]){
                count++;
            }
        }
        System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays 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[] ans = new int[5];
        int count = 0;
        for(int i = A;i <= B;i++){
            int j = 0;
            int x = i;
            while(x > 0){
                ans[j++] = x % 10;
                x /= 10;
                //System.out.println("i = " + x);
                //System.out.println("ans[] = " + ans[j]);
            }
            if(ans[0] == ans[4] && ans[1] == ans[3]){
                count++;
            }
        }
        System.out.println(count);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int[] ans = new int[5];
        int count = 0;
        for(int i = A;i <= B;i++){
            int j = 0;
            int x = i;
            while(x > 0){
                ans[j++] = x % 10;
                x /= 10;
                //System.out.println("i = " + x);
                //System.out.println("ans[] = " + ans[j]);
            }
            if(ans[0] == ans[4] && ans[1] == ans[3]){
                count++;
            }
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int[] ans = new int[5];
        int count = 0;
        for(int i = A;i <= B;i++){
            int j = 0;
            int x = i;
            while(x > 0){
                ans[j++] = x % 10;
                x /= 10;
                //System.out.println("i = " + x);
                //System.out.println("ans[] = " + ans[j]);
            }
            if(ans[0] == ans[4] && ans[1] == ans[3]){
                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[] ans = new int[5]; ans new int[5] 5 int count = 0; count 0 for(int i = A;i <= B;i++){
            int j = 0;
            int x = i;
            while(x > 0){
                ans[j++] = x % 10;
                x /= 10;
                //System.out.println("i = " + x);
                //System.out.println("ans[] = " + ans[j]);
            }
            if(ans[0] == ans[4] && ans[1] == ans[3]){
                count++;
            }
        } int i = A; int i = A; i A i <= B i B i++ i++ i {
            int j = 0;
            int x = i;
            while(x > 0){
                ans[j++] = x % 10;
                x /= 10;
                //System.out.println("i = " + x);
                //System.out.println("ans[] = " + ans[j]);
            }
            if(ans[0] == ans[4] && ans[1] == ans[3]){
                count++;
            }
        } {
            int j = 0;
            int x = i;
            while(x > 0){
                ans[j++] = x % 10;
                x /= 10;
                //System.out.println("i = " + x);
                //System.out.println("ans[] = " + ans[j]);
            }
            if(ans[0] == ans[4] && ans[1] == ans[3]){
                count++;
            }
        } int j = 0; j 0 int x = i; x i while(x > 0){
                ans[j++] = x % 10;
                x /= 10;
                //System.out.println("i = " + x);
                //System.out.println("ans[] = " + ans[j]);
            } x > 0 x 0 {
                ans[j++] = x % 10;
                x /= 10;
                //System.out.println("i = " + x);
                //System.out.println("ans[] = " + ans[j]);
            } ans[j++] = x % 10 ans[j++] ans j++ j x % 10 x 10 x /= 10 x 10 if(ans[0] == ans[4] && ans[1] == ans[3]){
                count++;
            } ans[0] == ans[4] && ans[1] == ans[3] ans[0] == ans[4] ans[0] ans 0 ans[4] ans 4 ans[1] == ans[3] ans[1] ans 1 ans[3] ans 3 {
                count++;
            } count++ count System.out.println(count) System.out.println System.out System System.out count 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[] ans = new int[5];
        int count = 0;
        for(int i = A;i <= B;i++){
            int j = 0;
            int x = i;
            while(x > 0){
                ans[j++] = x % 10;
                x /= 10;
                //System.out.println("i = " + x);
                //System.out.println("ans[] = " + ans[j]);
            }
            if(ans[0] == ans[4] && ans[1] == ans[3]){
                count++;
            }
        }
        System.out.println(count);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int[] ans = new int[5];
        int count = 0;
        for(int i = A;i <= B;i++){
            int j = 0;
            int x = i;
            while(x > 0){
                ans[j++] = x % 10;
                x /= 10;
                //System.out.println("i = " + x);
                //System.out.println("ans[] = " + ans[j]);
            }
            if(ans[0] == ans[4] && ans[1] == ans[3]){
                count++;
            }
        }
        System.out.println(count);
    }
} Main
import java.util.Scanner;
import java.util.Arrays;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int[] ans = new int[5];
        int count = 0;
        for(int i = A;i <= B;i++){
            int j = 0;
            int x = i;
            while(x > 0){
                ans[j++] = x % 10;
                x /= 10;
                //System.out.println("i = " + x);
                //System.out.println("ans[] = " + ans[j]);
            }
            if(ans[0] == ans[4] && ans[1] == ans[3]){
                count++;
            }
        }
        System.out.println(count);
    }
}
