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 x1 = 0;
      int x2 = 0;
      int x3 = 0;
      int x4 = 0;
      int x5 = 0;
      int count = 0;
      for(int i = a;i <= b;i++){
      	x5 = i%10;
        x1 = i/10000;
        x2 = (i-x1*10000)/1000;
        x3 = (i-x1*10000-x2*1000)/100;
        x4 = (i-x1*10000-x2*1000-x3*100)/10;
        if(x1==x5&&x2==x4)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();
      int x1 = 0;
      int x2 = 0;
      int x3 = 0;
      int x4 = 0;
      int x5 = 0;
      int count = 0;
      for(int i = a;i <= b;i++){
      	x5 = i%10;
        x1 = i/10000;
        x2 = (i-x1*10000)/1000;
        x3 = (i-x1*10000-x2*1000)/100;
        x4 = (i-x1*10000-x2*1000-x3*100)/10;
        if(x1==x5&&x2==x4)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 x1 = 0;
      int x2 = 0;
      int x3 = 0;
      int x4 = 0;
      int x5 = 0;
      int count = 0;
      for(int i = a;i <= b;i++){
      	x5 = i%10;
        x1 = i/10000;
        x2 = (i-x1*10000)/1000;
        x3 = (i-x1*10000-x2*1000)/100;
        x4 = (i-x1*10000-x2*1000-x3*100)/10;
        if(x1==x5&&x2==x4)count++;
      }
      System.out.println(count);
    } main {
    	Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      int x1 = 0;
      int x2 = 0;
      int x3 = 0;
      int x4 = 0;
      int x5 = 0;
      int count = 0;
      for(int i = a;i <= b;i++){
      	x5 = i%10;
        x1 = i/10000;
        x2 = (i-x1*10000)/1000;
        x3 = (i-x1*10000-x2*1000)/100;
        x4 = (i-x1*10000-x2*1000-x3*100)/10;
        if(x1==x5&&x2==x4)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 x1 = 0; x1 0 int x2 = 0; x2 0 int x3 = 0; x3 0 int x4 = 0; x4 0 int x5 = 0; x5 0 int count = 0; count 0 for(int i = a;i <= b;i++){
      	x5 = i%10;
        x1 = i/10000;
        x2 = (i-x1*10000)/1000;
        x3 = (i-x1*10000-x2*1000)/100;
        x4 = (i-x1*10000-x2*1000-x3*100)/10;
        if(x1==x5&&x2==x4)count++;
      } int i = a; int i = a; i a i <= b i b i++ i++ i {
      	x5 = i%10;
        x1 = i/10000;
        x2 = (i-x1*10000)/1000;
        x3 = (i-x1*10000-x2*1000)/100;
        x4 = (i-x1*10000-x2*1000-x3*100)/10;
        if(x1==x5&&x2==x4)count++;
      } {
      	x5 = i%10;
        x1 = i/10000;
        x2 = (i-x1*10000)/1000;
        x3 = (i-x1*10000-x2*1000)/100;
        x4 = (i-x1*10000-x2*1000-x3*100)/10;
        if(x1==x5&&x2==x4)count++;
      } x5 = i%10 x5 i%10 i 10 x1 = i/10000 x1 i/10000 i 10000 x2 = (i-x1*10000)/1000 x2 (i-x1*10000)/1000 (i-x1*10000) i x1*10000 x1 10000 1000 x3 = (i-x1*10000-x2*1000)/100 x3 (i-x1*10000-x2*1000)/100 (i-x1*10000-x2*1000) i-x1*10000-x2*1000 i x1*10000 x1 10000 x2*1000 x2 1000 100 x4 = (i-x1*10000-x2*1000-x3*100)/10 x4 (i-x1*10000-x2*1000-x3*100)/10 (i-x1*10000-x2*1000-x3*100) x2*1000 i-x1*10000-x2*1000-x3*100 i x1*10000 x1 10000 x2*1000 x2 1000 x3*100 x3 100 10 if(x1==x5&&x2==x4)count++; x1==x5&&x2==x4 x1==x5 x1 x5 x2==x4 x2 x4 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 x1 = 0;
      int x2 = 0;
      int x3 = 0;
      int x4 = 0;
      int x5 = 0;
      int count = 0;
      for(int i = a;i <= b;i++){
      	x5 = i%10;
        x1 = i/10000;
        x2 = (i-x1*10000)/1000;
        x3 = (i-x1*10000-x2*1000)/100;
        x4 = (i-x1*10000-x2*1000-x3*100)/10;
        if(x1==x5&&x2==x4)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 x1 = 0;
      int x2 = 0;
      int x3 = 0;
      int x4 = 0;
      int x5 = 0;
      int count = 0;
      for(int i = a;i <= b;i++){
      	x5 = i%10;
        x1 = i/10000;
        x2 = (i-x1*10000)/1000;
        x3 = (i-x1*10000-x2*1000)/100;
        x4 = (i-x1*10000-x2*1000-x3*100)/10;
        if(x1==x5&&x2==x4)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();
      int x1 = 0;
      int x2 = 0;
      int x3 = 0;
      int x4 = 0;
      int x5 = 0;
      int count = 0;
      for(int i = a;i <= b;i++){
      	x5 = i%10;
        x1 = i/10000;
        x2 = (i-x1*10000)/1000;
        x3 = (i-x1*10000-x2*1000)/100;
        x4 = (i-x1*10000-x2*1000-x3*100)/10;
        if(x1==x5&&x2==x4)count++;
      }
      System.out.println(count);
    }
}
