import java.util.HashMap;
import java.util.Map;
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();
        int count = 0;
        for (int i = a; i <= b; i++) {
            int keta1 = i / 10000;
            int keta2 = i / 1000 % 10;
            int keta4 = i / 10 % 10;
            int keta5 = i % 10;
            if (keta1 == keta5 && keta2 == keta4) count++;
        }

        System.out.println(count);
    }
} import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util 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();
        int count = 0;
        for (int i = a; i <= b; i++) {
            int keta1 = i / 10000;
            int keta2 = i / 1000 % 10;
            int keta4 = i / 10 % 10;
            int keta5 = i % 10;
            if (keta1 == keta5 && keta2 == keta4) 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 count = 0;
        for (int i = a; i <= b; i++) {
            int keta1 = i / 10000;
            int keta2 = i / 1000 % 10;
            int keta4 = i / 10 % 10;
            int keta5 = i % 10;
            if (keta1 == keta5 && keta2 == keta4) count++;
        }

        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b; i++) {
            int keta1 = i / 10000;
            int keta2 = i / 1000 % 10;
            int keta4 = i / 10 % 10;
            int keta5 = i % 10;
            if (keta1 == keta5 && keta2 == keta4) 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 count = 0; count 0 for (int i = a; i <= b; i++) {
            int keta1 = i / 10000;
            int keta2 = i / 1000 % 10;
            int keta4 = i / 10 % 10;
            int keta5 = i % 10;
            if (keta1 == keta5 && keta2 == keta4) count++;
        } int i = a; int i = a; i a i <= b i b i++ i++ i {
            int keta1 = i / 10000;
            int keta2 = i / 1000 % 10;
            int keta4 = i / 10 % 10;
            int keta5 = i % 10;
            if (keta1 == keta5 && keta2 == keta4) count++;
        } {
            int keta1 = i / 10000;
            int keta2 = i / 1000 % 10;
            int keta4 = i / 10 % 10;
            int keta5 = i % 10;
            if (keta1 == keta5 && keta2 == keta4) count++;
        } int keta1 = i / 10000; keta1 i / 10000 i 10000 int keta2 = i / 1000 % 10; keta2 i / 1000 % 10 i / 1000 i 1000 10 int keta4 = i / 10 % 10; keta4 i / 10 % 10 i / 10 i 10 10 int keta5 = i % 10; keta5 i % 10 i 10 if (keta1 == keta5 && keta2 == keta4) count++; keta1 == keta5 && keta2 == keta4 keta1 == keta5 keta1 keta5 keta2 == keta4 keta2 keta4 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 count = 0;
        for (int i = a; i <= b; i++) {
            int keta1 = i / 10000;
            int keta2 = i / 1000 % 10;
            int keta4 = i / 10 % 10;
            int keta5 = i % 10;
            if (keta1 == keta5 && keta2 == keta4) 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 count = 0;
        for (int i = a; i <= b; i++) {
            int keta1 = i / 10000;
            int keta2 = i / 1000 % 10;
            int keta4 = i / 10 % 10;
            int keta5 = i % 10;
            if (keta1 == keta5 && keta2 == keta4) count++;
        }

        System.out.println(count);
    }
} Main
import java.util.HashMap;
import java.util.Map;
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();
        int count = 0;
        for (int i = a; i <= b; i++) {
            int keta1 = i / 10000;
            int keta2 = i / 1000 % 10;
            int keta4 = i / 10 % 10;
            int keta5 = i % 10;
            if (keta1 == keta5 && keta2 == keta4) count++;
        }

        System.out.println(count);
    }
}