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 count = 0;
  int[] d = new int[5];
  for(int i = A;i<=B;i++){
    d[0] = i/10000;
    d[1] = (i%10000)/1000;
    d[2] = (i%1000)/100;
    d[3] = (i%100)/10;
    d[4] = i%10;
    if(d[0] == d[4]&& d[1] == d[3]){count += 1;}
  }
    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 count = 0;
  int[] d = new int[5];
  for(int i = A;i<=B;i++){
    d[0] = i/10000;
    d[1] = (i%10000)/1000;
    d[2] = (i%1000)/100;
    d[3] = (i%100)/10;
    d[4] = i%10;
    if(d[0] == d[4]&& d[1] == d[3]){count += 1;}
  }
    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 count = 0;
  int[] d = new int[5];
  for(int i = A;i<=B;i++){
    d[0] = i/10000;
    d[1] = (i%10000)/1000;
    d[2] = (i%1000)/100;
    d[3] = (i%100)/10;
    d[4] = i%10;
    if(d[0] == d[4]&& d[1] == d[3]){count += 1;}
  }
    System.out.println(count);
} main {
Scanner sc = new Scanner(System.in);
  int A = sc.nextInt();
  int B = sc.nextInt();
  int count = 0;
  int[] d = new int[5];
  for(int i = A;i<=B;i++){
    d[0] = i/10000;
    d[1] = (i%10000)/1000;
    d[2] = (i%1000)/100;
    d[3] = (i%100)/10;
    d[4] = i%10;
    if(d[0] == d[4]&& d[1] == d[3]){count += 1;}
  }
    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 count = 0; count 0 int[] d = new int[5]; d new int[5] 5 for(int i = A;i<=B;i++){
    d[0] = i/10000;
    d[1] = (i%10000)/1000;
    d[2] = (i%1000)/100;
    d[3] = (i%100)/10;
    d[4] = i%10;
    if(d[0] == d[4]&& d[1] == d[3]){count += 1;}
  } int i = A; int i = A; i A i<=B i B i++ i++ i {
    d[0] = i/10000;
    d[1] = (i%10000)/1000;
    d[2] = (i%1000)/100;
    d[3] = (i%100)/10;
    d[4] = i%10;
    if(d[0] == d[4]&& d[1] == d[3]){count += 1;}
  } {
    d[0] = i/10000;
    d[1] = (i%10000)/1000;
    d[2] = (i%1000)/100;
    d[3] = (i%100)/10;
    d[4] = i%10;
    if(d[0] == d[4]&& d[1] == d[3]){count += 1;}
  } d[0] = i/10000 d[0] d 0 i/10000 i 10000 d[1] = (i%10000)/1000 d[1] d 1 (i%10000)/1000 (i%10000) i 10000 1000 d[2] = (i%1000)/100 d[2] d 2 (i%1000)/100 (i%1000) i 1000 100 d[3] = (i%100)/10 d[3] d 3 (i%100)/10 (i%100) i 100 10 d[4] = i%10 d[4] d 4 i%10 i 10 if(d[0] == d[4]&& d[1] == d[3]){count += 1;} d[0] == d[4]&& d[1] == d[3] d[0] == d[4] d[0] d 0 d[4] d 4 d[1] == d[3] d[1] d 1 d[3] d 3 {count += 1;} count += 1 count 1 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 count = 0;
  int[] d = new int[5];
  for(int i = A;i<=B;i++){
    d[0] = i/10000;
    d[1] = (i%10000)/1000;
    d[2] = (i%1000)/100;
    d[3] = (i%100)/10;
    d[4] = i%10;
    if(d[0] == d[4]&& d[1] == d[3]){count += 1;}
  }
    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 count = 0;
  int[] d = new int[5];
  for(int i = A;i<=B;i++){
    d[0] = i/10000;
    d[1] = (i%10000)/1000;
    d[2] = (i%1000)/100;
    d[3] = (i%100)/10;
    d[4] = i%10;
    if(d[0] == d[4]&& d[1] == d[3]){count += 1;}
  }
    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 count = 0;
  int[] d = new int[5];
  for(int i = A;i<=B;i++){
    d[0] = i/10000;
    d[1] = (i%10000)/1000;
    d[2] = (i%1000)/100;
    d[3] = (i%100)/10;
    d[4] = i%10;
    if(d[0] == d[4]&& d[1] == d[3]){count += 1;}
  }
    System.out.println(count);
}
}
      
    
