import 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 count = 0;

    for (int i = A; i <= B; i++) {
      
      String i_ = String.valueOf(i);
      String[] I = i_.split("");

      if (I[0].equals(I[4]) && I[1].equals(I[3])) {
        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 = sc.nextInt();
    int B = sc.nextInt();

    sc.close();

    int count = 0;

    for (int i = A; i <= B; i++) {
      
      String i_ = String.valueOf(i);
      String[] I = i_.split("");

      if (I[0].equals(I[4]) && I[1].equals(I[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();

    sc.close();

    int count = 0;

    for (int i = A; i <= B; i++) {
      
      String i_ = String.valueOf(i);
      String[] I = i_.split("");

      if (I[0].equals(I[4]) && I[1].equals(I[3])) {
        count++;
      }

    }

    System.out.println(count);

  } main {

    Scanner sc = new Scanner(System.in);

    int A = sc.nextInt();
    int B = sc.nextInt();

    sc.close();

    int count = 0;

    for (int i = A; i <= B; i++) {
      
      String i_ = String.valueOf(i);
      String[] I = i_.split("");

      if (I[0].equals(I[4]) && I[1].equals(I[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 sc.close() sc.close sc int count = 0; count 0 for (int i = A; i <= B; i++) {
      
      String i_ = String.valueOf(i);
      String[] I = i_.split("");

      if (I[0].equals(I[4]) && I[1].equals(I[3])) {
        count++;
      }

    } int i = A; int i = A; i A i <= B i B i++ i++ i {
      
      String i_ = String.valueOf(i);
      String[] I = i_.split("");

      if (I[0].equals(I[4]) && I[1].equals(I[3])) {
        count++;
      }

    } {
      
      String i_ = String.valueOf(i);
      String[] I = i_.split("");

      if (I[0].equals(I[4]) && I[1].equals(I[3])) {
        count++;
      }

    } String i_ = String.valueOf(i); i_ String.valueOf(i) String.valueOf String i String[] I = i_.split(""); I i_.split("") i_.split i_ "" if (I[0].equals(I[4]) && I[1].equals(I[3])) {
        count++;
      } I[0].equals(I[4]) && I[1].equals(I[3]) I[0].equals(I[4]) I[0].equals I[0] I 0 I[4] I 4 I[1].equals(I[3]) I[1].equals I[1] I 1 I[3] I 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();

    sc.close();

    int count = 0;

    for (int i = A; i <= B; i++) {
      
      String i_ = String.valueOf(i);
      String[] I = i_.split("");

      if (I[0].equals(I[4]) && I[1].equals(I[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();

    sc.close();

    int count = 0;

    for (int i = A; i <= B; i++) {
      
      String i_ = String.valueOf(i);
      String[] I = i_.split("");

      if (I[0].equals(I[4]) && I[1].equals(I[3])) {
        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 = sc.nextInt();
    int B = sc.nextInt();

    sc.close();

    int count = 0;

    for (int i = A; i <= B; i++) {
      
      String i_ = String.valueOf(i);
      String[] I = i_.split("");

      if (I[0].equals(I[4]) && I[1].equals(I[3])) {
        count++;
      }

    }

    System.out.println(count);

  }

}