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();
    int n = 0;
    
    for (int i = 0; i < (b - a + 1); i++) {
      String s[] = String.valueOf(a + i).split("");
      String t = s[4] + s[3] + s[2] + s[1] + s[0];
      
      if (String.valueOf(a + i).equals(t)) n++;
    }
    
    System.out.println(n);
  }
} 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();
    int n = 0;
    
    for (int i = 0; i < (b - a + 1); i++) {
      String s[] = String.valueOf(a + i).split("");
      String t = s[4] + s[3] + s[2] + s[1] + s[0];
      
      if (String.valueOf(a + i).equals(t)) n++;
    }
    
    System.out.println(n);
  }
} Main public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int n = 0;
    
    for (int i = 0; i < (b - a + 1); i++) {
      String s[] = String.valueOf(a + i).split("");
      String t = s[4] + s[3] + s[2] + s[1] + s[0];
      
      if (String.valueOf(a + i).equals(t)) n++;
    }
    
    System.out.println(n);
  } main {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int n = 0;
    
    for (int i = 0; i < (b - a + 1); i++) {
      String s[] = String.valueOf(a + i).split("");
      String t = s[4] + s[3] + s[2] + s[1] + s[0];
      
      if (String.valueOf(a + i).equals(t)) n++;
    }
    
    System.out.println(n);
  } 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 n = 0; n 0 for (int i = 0; i < (b - a + 1); i++) {
      String s[] = String.valueOf(a + i).split("");
      String t = s[4] + s[3] + s[2] + s[1] + s[0];
      
      if (String.valueOf(a + i).equals(t)) n++;
    } int i = 0; int i = 0; i 0 i < (b - a + 1) i (b - a + 1) b - a b a 1 i++ i++ i {
      String s[] = String.valueOf(a + i).split("");
      String t = s[4] + s[3] + s[2] + s[1] + s[0];
      
      if (String.valueOf(a + i).equals(t)) n++;
    } {
      String s[] = String.valueOf(a + i).split("");
      String t = s[4] + s[3] + s[2] + s[1] + s[0];
      
      if (String.valueOf(a + i).equals(t)) n++;
    } String s[] = String.valueOf(a + i).split(""); s String.valueOf(a + i).split("") String.valueOf(a + i).split String.valueOf(a + i) String.valueOf String a + i a i "" String t = s[4] + s[3] + s[2] + s[1] + s[0]; t s[4] + s[3] + s[2] + s[1] + s[0] s[1] s[2] s[4] + s[3] + s[2] + s[1] + s[0] s[4] s 4 s[3] s 3 s[2] s 2 s[1] s 1 s[0] s 0 if (String.valueOf(a + i).equals(t)) n++; String.valueOf(a + i).equals(t) String.valueOf(a + i).equals String.valueOf(a + i) String.valueOf String a + i a i t n++ n System.out.println(n) System.out.println System.out System System.out n 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 n = 0;
    
    for (int i = 0; i < (b - a + 1); i++) {
      String s[] = String.valueOf(a + i).split("");
      String t = s[4] + s[3] + s[2] + s[1] + s[0];
      
      if (String.valueOf(a + i).equals(t)) n++;
    }
    
    System.out.println(n);
  }
} public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int n = 0;
    
    for (int i = 0; i < (b - a + 1); i++) {
      String s[] = String.valueOf(a + i).split("");
      String t = s[4] + s[3] + s[2] + s[1] + s[0];
      
      if (String.valueOf(a + i).equals(t)) n++;
    }
    
    System.out.println(n);
  }
} 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();
    int n = 0;
    
    for (int i = 0; i < (b - a + 1); i++) {
      String s[] = String.valueOf(a + i).split("");
      String t = s[4] + s[3] + s[2] + s[1] + s[0];
      
      if (String.valueOf(a + i).equals(t)) n++;
    }
    
    System.out.println(n);
  }
}