import java.util.*;
 
class Main {
  
   public static int findSumOfDigits (int n){
     int conut = 0;
     int buf[] = new int[5];
     int flag = 0;
     
     while(n>0){
       buf[conut]=n%10;
       n = n/10;
       conut++;
     } 
     if(buf[0]==buf[1]&&buf[3]==buf[4]){
       if(buf[0]==buf[4]){
         flag = 1;
       }
     }else if(buf[0]==buf[4]&&buf[1]==buf[3]){
       flag = 1;
     }
     return flag;
   }
  
  
    public static void main(String[] args) {
      
      
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int conut = 0;
      for(int i=A;i<=B;i++){
        int flag = findSumOfDigits(i);
        if(flag==1){
          conut++;
        }
      }

		System.out.print(conut);
    }
} import java.util.*; util.* java class Main {
  
   public static int findSumOfDigits (int n){
     int conut = 0;
     int buf[] = new int[5];
     int flag = 0;
     
     while(n>0){
       buf[conut]=n%10;
       n = n/10;
       conut++;
     } 
     if(buf[0]==buf[1]&&buf[3]==buf[4]){
       if(buf[0]==buf[4]){
         flag = 1;
       }
     }else if(buf[0]==buf[4]&&buf[1]==buf[3]){
       flag = 1;
     }
     return flag;
   }
  
  
    public static void main(String[] args) {
      
      
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int conut = 0;
      for(int i=A;i<=B;i++){
        int flag = findSumOfDigits(i);
        if(flag==1){
          conut++;
        }
      }

		System.out.print(conut);
    }
} Main public static int findSumOfDigits (int n){
     int conut = 0;
     int buf[] = new int[5];
     int flag = 0;
     
     while(n>0){
       buf[conut]=n%10;
       n = n/10;
       conut++;
     } 
     if(buf[0]==buf[1]&&buf[3]==buf[4]){
       if(buf[0]==buf[4]){
         flag = 1;
       }
     }else if(buf[0]==buf[4]&&buf[1]==buf[3]){
       flag = 1;
     }
     return flag;
   } findSumOfDigits {
     int conut = 0;
     int buf[] = new int[5];
     int flag = 0;
     
     while(n>0){
       buf[conut]=n%10;
       n = n/10;
       conut++;
     } 
     if(buf[0]==buf[1]&&buf[3]==buf[4]){
       if(buf[0]==buf[4]){
         flag = 1;
       }
     }else if(buf[0]==buf[4]&&buf[1]==buf[3]){
       flag = 1;
     }
     return flag;
   } int conut = 0; conut 0 int buf[] = new int[5]; buf new int[5] 5 int flag = 0; flag 0 while(n>0){
       buf[conut]=n%10;
       n = n/10;
       conut++;
     } n>0 n 0 {
       buf[conut]=n%10;
       n = n/10;
       conut++;
     } buf[conut]=n%10 buf[conut] buf conut n%10 n 10 n = n/10 n n/10 n 10 conut++ conut if(buf[0]==buf[1]&&buf[3]==buf[4]){
       if(buf[0]==buf[4]){
         flag = 1;
       }
     }else if(buf[0]==buf[4]&&buf[1]==buf[3]){
       flag = 1;
     } buf[0]==buf[1]&&buf[3]==buf[4] buf[0]==buf[1] buf[0] buf 0 buf[1] buf 1 buf[3]==buf[4] buf[3] buf 3 buf[4] buf 4 {
       if(buf[0]==buf[4]){
         flag = 1;
       }
     } if(buf[0]==buf[4]){
         flag = 1;
       } buf[0]==buf[4] buf[0] buf 0 buf[4] buf 4 {
         flag = 1;
       } flag = 1 flag 1 if(buf[0]==buf[4]&&buf[1]==buf[3]){
       flag = 1;
     } buf[0]==buf[4]&&buf[1]==buf[3] buf[0]==buf[4] buf[0] buf 0 buf[4] buf 4 buf[1]==buf[3] buf[1] buf 1 buf[3] buf 3 {
       flag = 1;
     } flag = 1 flag 1 return flag; flag int n n public static void main(String[] args) {
      
      
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int conut = 0;
      for(int i=A;i<=B;i++){
        int flag = findSumOfDigits(i);
        if(flag==1){
          conut++;
        }
      }

		System.out.print(conut);
    } main {
      
      
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int conut = 0;
      for(int i=A;i<=B;i++){
        int flag = findSumOfDigits(i);
        if(flag==1){
          conut++;
        }
      }

		System.out.print(conut);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = Integer.parseInt(sc.next()); A Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int B = Integer.parseInt(sc.next()); B Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int conut = 0; conut 0 for(int i=A;i<=B;i++){
        int flag = findSumOfDigits(i);
        if(flag==1){
          conut++;
        }
      } int i=A; int i=A; i A i<=B i B i++ i++ i {
        int flag = findSumOfDigits(i);
        if(flag==1){
          conut++;
        }
      } {
        int flag = findSumOfDigits(i);
        if(flag==1){
          conut++;
        }
      } int flag = findSumOfDigits(i); flag findSumOfDigits(i) findSumOfDigits i if(flag==1){
          conut++;
        } flag==1 flag 1 {
          conut++;
        } conut++ conut System.out.print(conut) System.out.print System.out System System.out conut String[] args args
import java.util.*;
 
class Main {
  
   public static int findSumOfDigits (int n){
     int conut = 0;
     int buf[] = new int[5];
     int flag = 0;
     
     while(n>0){
       buf[conut]=n%10;
       n = n/10;
       conut++;
     } 
     if(buf[0]==buf[1]&&buf[3]==buf[4]){
       if(buf[0]==buf[4]){
         flag = 1;
       }
     }else if(buf[0]==buf[4]&&buf[1]==buf[3]){
       flag = 1;
     }
     return flag;
   }
  
  
    public static void main(String[] args) {
      
      
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int conut = 0;
      for(int i=A;i<=B;i++){
        int flag = findSumOfDigits(i);
        if(flag==1){
          conut++;
        }
      }

		System.out.print(conut);
    }
}