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 c = 0;
	      int x, y, n, p;
	      for(int i = A; i <= B; i++) {
	      x = i / 10000;
	      y = i % 10;
	      n = i / 1000 - x * 10;
	      p = (i % 100 -y) / 10;
	      if(x == y && n == p) {
	    	  c++;
	      }
	      }
	      System.out.println(c);
	}
} 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 c = 0;
	      int x, y, n, p;
	      for(int i = A; i <= B; i++) {
	      x = i / 10000;
	      y = i % 10;
	      n = i / 1000 - x * 10;
	      p = (i % 100 -y) / 10;
	      if(x == y && n == p) {
	    	  c++;
	      }
	      }
	      System.out.println(c);
	}
} Main public static void main(String[] args){
	      Scanner sc = new Scanner(System.in);
	      int A = sc.nextInt();
	      int B = sc.nextInt();
	      int c = 0;
	      int x, y, n, p;
	      for(int i = A; i <= B; i++) {
	      x = i / 10000;
	      y = i % 10;
	      n = i / 1000 - x * 10;
	      p = (i % 100 -y) / 10;
	      if(x == y && n == p) {
	    	  c++;
	      }
	      }
	      System.out.println(c);
	} main {
	      Scanner sc = new Scanner(System.in);
	      int A = sc.nextInt();
	      int B = sc.nextInt();
	      int c = 0;
	      int x, y, n, p;
	      for(int i = A; i <= B; i++) {
	      x = i / 10000;
	      y = i % 10;
	      n = i / 1000 - x * 10;
	      p = (i % 100 -y) / 10;
	      if(x == y && n == p) {
	    	  c++;
	      }
	      }
	      System.out.println(c);
	} 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 c = 0; c 0 int x x y y n n p; p for(int i = A; i <= B; i++) {
	      x = i / 10000;
	      y = i % 10;
	      n = i / 1000 - x * 10;
	      p = (i % 100 -y) / 10;
	      if(x == y && n == p) {
	    	  c++;
	      }
	      } int i = A; int i = A; i A i <= B i B i++ i++ i {
	      x = i / 10000;
	      y = i % 10;
	      n = i / 1000 - x * 10;
	      p = (i % 100 -y) / 10;
	      if(x == y && n == p) {
	    	  c++;
	      }
	      } {
	      x = i / 10000;
	      y = i % 10;
	      n = i / 1000 - x * 10;
	      p = (i % 100 -y) / 10;
	      if(x == y && n == p) {
	    	  c++;
	      }
	      } x = i / 10000 x i / 10000 i 10000 y = i % 10 y i % 10 i 10 n = i / 1000 - x * 10 n i / 1000 - x * 10 i / 1000 i 1000 x * 10 x 10 p = (i % 100 -y) / 10 p (i % 100 -y) / 10 (i % 100 -y) i % 100 i 100 y 10 if(x == y && n == p) {
	    	  c++;
	      } x == y && n == p x == y x y n == p n p {
	    	  c++;
	      } c++ c System.out.println(c) System.out.println System.out System System.out c 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 c = 0;
	      int x, y, n, p;
	      for(int i = A; i <= B; i++) {
	      x = i / 10000;
	      y = i % 10;
	      n = i / 1000 - x * 10;
	      p = (i % 100 -y) / 10;
	      if(x == y && n == p) {
	    	  c++;
	      }
	      }
	      System.out.println(c);
	}
} public class Main {
	public static void main(String[] args){
	      Scanner sc = new Scanner(System.in);
	      int A = sc.nextInt();
	      int B = sc.nextInt();
	      int c = 0;
	      int x, y, n, p;
	      for(int i = A; i <= B; i++) {
	      x = i / 10000;
	      y = i % 10;
	      n = i / 1000 - x * 10;
	      p = (i % 100 -y) / 10;
	      if(x == y && n == p) {
	    	  c++;
	      }
	      }
	      System.out.println(c);
	}
} 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();
	      int c = 0;
	      int x, y, n, p;
	      for(int i = A; i <= B; i++) {
	      x = i / 10000;
	      y = i % 10;
	      n = i / 1000 - x * 10;
	      p = (i % 100 -y) / 10;
	      if(x == y && n == p) {
	    	  c++;
	      }
	      }
	      System.out.println(c);
	}
}