import java.util.Scanner;

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

        int output = 0;
        for(int i=a; i<=b; i++) {
            int tmp = i;
            int[] num = new int[5];
            int loopCnt = 0;
            while(loopCnt < 5) {
                num[loopCnt] = tmp % 10;
                if(tmp / 10 > 0) {
                    tmp /= 10;
                } else {
                    break;
                }
                loopCnt++;
            }
            if(num[0] == num[4] && num[1] == num[3]) {
                output++;
            }
        }
        System.out.println(output);
    }
} import java.util.Scanner; Scanner 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();
        sc.close();

        int output = 0;
        for(int i=a; i<=b; i++) {
            int tmp = i;
            int[] num = new int[5];
            int loopCnt = 0;
            while(loopCnt < 5) {
                num[loopCnt] = tmp % 10;
                if(tmp / 10 > 0) {
                    tmp /= 10;
                } else {
                    break;
                }
                loopCnt++;
            }
            if(num[0] == num[4] && num[1] == num[3]) {
                output++;
            }
        }
        System.out.println(output);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();

        int output = 0;
        for(int i=a; i<=b; i++) {
            int tmp = i;
            int[] num = new int[5];
            int loopCnt = 0;
            while(loopCnt < 5) {
                num[loopCnt] = tmp % 10;
                if(tmp / 10 > 0) {
                    tmp /= 10;
                } else {
                    break;
                }
                loopCnt++;
            }
            if(num[0] == num[4] && num[1] == num[3]) {
                output++;
            }
        }
        System.out.println(output);
    } main {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();

        int output = 0;
        for(int i=a; i<=b; i++) {
            int tmp = i;
            int[] num = new int[5];
            int loopCnt = 0;
            while(loopCnt < 5) {
                num[loopCnt] = tmp % 10;
                if(tmp / 10 > 0) {
                    tmp /= 10;
                } else {
                    break;
                }
                loopCnt++;
            }
            if(num[0] == num[4] && num[1] == num[3]) {
                output++;
            }
        }
        System.out.println(output);
    } 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 sc.close() sc.close sc int output = 0; output 0 for(int i=a; i<=b; i++) {
            int tmp = i;
            int[] num = new int[5];
            int loopCnt = 0;
            while(loopCnt < 5) {
                num[loopCnt] = tmp % 10;
                if(tmp / 10 > 0) {
                    tmp /= 10;
                } else {
                    break;
                }
                loopCnt++;
            }
            if(num[0] == num[4] && num[1] == num[3]) {
                output++;
            }
        } int i=a; int i=a; i a i<=b i b i++ i++ i {
            int tmp = i;
            int[] num = new int[5];
            int loopCnt = 0;
            while(loopCnt < 5) {
                num[loopCnt] = tmp % 10;
                if(tmp / 10 > 0) {
                    tmp /= 10;
                } else {
                    break;
                }
                loopCnt++;
            }
            if(num[0] == num[4] && num[1] == num[3]) {
                output++;
            }
        } {
            int tmp = i;
            int[] num = new int[5];
            int loopCnt = 0;
            while(loopCnt < 5) {
                num[loopCnt] = tmp % 10;
                if(tmp / 10 > 0) {
                    tmp /= 10;
                } else {
                    break;
                }
                loopCnt++;
            }
            if(num[0] == num[4] && num[1] == num[3]) {
                output++;
            }
        } int tmp = i; tmp i int[] num = new int[5]; num new int[5] 5 int loopCnt = 0; loopCnt 0 while(loopCnt < 5) {
                num[loopCnt] = tmp % 10;
                if(tmp / 10 > 0) {
                    tmp /= 10;
                } else {
                    break;
                }
                loopCnt++;
            } loopCnt < 5 loopCnt 5 {
                num[loopCnt] = tmp % 10;
                if(tmp / 10 > 0) {
                    tmp /= 10;
                } else {
                    break;
                }
                loopCnt++;
            } num[loopCnt] = tmp % 10 num[loopCnt] num loopCnt tmp % 10 tmp 10 if(tmp / 10 > 0) {
                    tmp /= 10;
                } else {
                    break;
                } tmp / 10 > 0 tmp / 10 tmp 10 0 {
                    tmp /= 10;
                } tmp /= 10 tmp 10 {
                    break;
                } break; loopCnt++ loopCnt if(num[0] == num[4] && num[1] == num[3]) {
                output++;
            } num[0] == num[4] && num[1] == num[3] num[0] == num[4] num[0] num 0 num[4] num 4 num[1] == num[3] num[1] num 1 num[3] num 3 {
                output++;
            } output++ output System.out.println(output) System.out.println System.out System System.out output 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();
        sc.close();

        int output = 0;
        for(int i=a; i<=b; i++) {
            int tmp = i;
            int[] num = new int[5];
            int loopCnt = 0;
            while(loopCnt < 5) {
                num[loopCnt] = tmp % 10;
                if(tmp / 10 > 0) {
                    tmp /= 10;
                } else {
                    break;
                }
                loopCnt++;
            }
            if(num[0] == num[4] && num[1] == num[3]) {
                output++;
            }
        }
        System.out.println(output);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();

        int output = 0;
        for(int i=a; i<=b; i++) {
            int tmp = i;
            int[] num = new int[5];
            int loopCnt = 0;
            while(loopCnt < 5) {
                num[loopCnt] = tmp % 10;
                if(tmp / 10 > 0) {
                    tmp /= 10;
                } else {
                    break;
                }
                loopCnt++;
            }
            if(num[0] == num[4] && num[1] == num[3]) {
                output++;
            }
        }
        System.out.println(output);
    }
} Main
import java.util.Scanner;

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

        int output = 0;
        for(int i=a; i<=b; i++) {
            int tmp = i;
            int[] num = new int[5];
            int loopCnt = 0;
            while(loopCnt < 5) {
                num[loopCnt] = tmp % 10;
                if(tmp / 10 > 0) {
                    tmp /= 10;
                } else {
                    break;
                }
                loopCnt++;
            }
            if(num[0] == num[4] && num[1] == num[3]) {
                output++;
            }
        }
        System.out.println(output);
    }
}
