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

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

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