import java.util.*;
 
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 count = 0;
        for(int i=A; i<=B; i++) {
            int num = i;
            int a = num % 10;
            num /= 10;
            int b = num % 10;
            num /= 10;
            int c = num % 10;
            num /= 10;
            int d = num % 10;
            num /= 10;
            int e = num;
            if(a == e && b == d) count++;
        }
        System.out.println(count);
    } 
} import java.util.*; util.* 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 count = 0;
        for(int i=A; i<=B; i++) {
            int num = i;
            int a = num % 10;
            num /= 10;
            int b = num % 10;
            num /= 10;
            int c = num % 10;
            num /= 10;
            int d = num % 10;
            num /= 10;
            int e = num;
            if(a == e && b == d) count++;
        }
        System.out.println(count);
    } 
} 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 count = 0;
        for(int i=A; i<=B; i++) {
            int num = i;
            int a = num % 10;
            num /= 10;
            int b = num % 10;
            num /= 10;
            int c = num % 10;
            num /= 10;
            int d = num % 10;
            num /= 10;
            int e = num;
            if(a == e && b == d) count++;
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int count = 0;
        for(int i=A; i<=B; i++) {
            int num = i;
            int a = num % 10;
            num /= 10;
            int b = num % 10;
            num /= 10;
            int c = num % 10;
            num /= 10;
            int d = num % 10;
            num /= 10;
            int e = num;
            if(a == e && b == d) count++;
        }
        System.out.println(count);
    } 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 count = 0; count 0 for(int i=A; i<=B; i++) {
            int num = i;
            int a = num % 10;
            num /= 10;
            int b = num % 10;
            num /= 10;
            int c = num % 10;
            num /= 10;
            int d = num % 10;
            num /= 10;
            int e = num;
            if(a == e && b == d) count++;
        } int i=A; int i=A; i A i<=B i B i++ i++ i {
            int num = i;
            int a = num % 10;
            num /= 10;
            int b = num % 10;
            num /= 10;
            int c = num % 10;
            num /= 10;
            int d = num % 10;
            num /= 10;
            int e = num;
            if(a == e && b == d) count++;
        } {
            int num = i;
            int a = num % 10;
            num /= 10;
            int b = num % 10;
            num /= 10;
            int c = num % 10;
            num /= 10;
            int d = num % 10;
            num /= 10;
            int e = num;
            if(a == e && b == d) count++;
        } int num = i; num i int a = num % 10; a num % 10 num 10 num /= 10 num 10 int b = num % 10; b num % 10 num 10 num /= 10 num 10 int c = num % 10; c num % 10 num 10 num /= 10 num 10 int d = num % 10; d num % 10 num 10 num /= 10 num 10 int e = num; e num if(a == e && b == d) count++; a == e && b == d a == e a e b == d b d 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 = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int count = 0;
        for(int i=A; i<=B; i++) {
            int num = i;
            int a = num % 10;
            num /= 10;
            int b = num % 10;
            num /= 10;
            int c = num % 10;
            num /= 10;
            int d = num % 10;
            num /= 10;
            int e = num;
            if(a == e && b == d) count++;
        }
        System.out.println(count);
    } 
} 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 count = 0;
        for(int i=A; i<=B; i++) {
            int num = i;
            int a = num % 10;
            num /= 10;
            int b = num % 10;
            num /= 10;
            int c = num % 10;
            num /= 10;
            int d = num % 10;
            num /= 10;
            int e = num;
            if(a == e && b == d) count++;
        }
        System.out.println(count);
    } 
} Main
import java.util.*;
 
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 count = 0;
        for(int i=A; i<=B; i++) {
            int num = i;
            int a = num % 10;
            num /= 10;
            int b = num % 10;
            num /= 10;
            int c = num % 10;
            num /= 10;
            int d = num % 10;
            num /= 10;
            int e = num;
            if(a == e && b == d) count++;
        }
        System.out.println(count);
    } 
}