import java.util.Scanner;
public class Main{
  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 count = 0;
    
    for(int i = A; i <= B; i++){
    	int a = i / 10000;
        int b = i % 10;
        if(a != b) continue;
      	a = (i / 1000)% 10;
        b = (i / 10) % 10;
        if(a == b) count++;
    }
    System.out.println(count);
  }
}

 import java.util.Scanner; Scanner java.util public class Main{
  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 count = 0;
    
    for(int i = A; i <= B; i++){
    	int a = i / 10000;
        int b = i % 10;
        if(a != b) continue;
      	a = (i / 1000)% 10;
        b = (i / 10) % 10;
        if(a == b) count++;
    }
    System.out.println(count);
  }
} Main 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 count = 0;
    
    for(int i = A; i <= B; i++){
    	int a = i / 10000;
        int b = i % 10;
        if(a != b) continue;
      	a = (i / 1000)% 10;
        b = (i / 10) % 10;
        if(a == b) count++;
    }
    System.out.println(count);
  } main {
	Scanner sc = new Scanner(System.in);
    int A = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());
    int count = 0;
    
    for(int i = A; i <= B; i++){
    	int a = i / 10000;
        int b = i % 10;
        if(a != b) continue;
      	a = (i / 1000)% 10;
        b = (i / 10) % 10;
        if(a == b) count++;
    }
    System.out.println(count);
  } 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 count = 0; count 0 for(int i = A; i <= B; i++){
    	int a = i / 10000;
        int b = i % 10;
        if(a != b) continue;
      	a = (i / 1000)% 10;
        b = (i / 10) % 10;
        if(a == b) count++;
    } int i = A; int i = A; i A i <= B i B i++ i++ i {
    	int a = i / 10000;
        int b = i % 10;
        if(a != b) continue;
      	a = (i / 1000)% 10;
        b = (i / 10) % 10;
        if(a == b) count++;
    } {
    	int a = i / 10000;
        int b = i % 10;
        if(a != b) continue;
      	a = (i / 1000)% 10;
        b = (i / 10) % 10;
        if(a == b) count++;
    } int a = i / 10000; a i / 10000 i 10000 int b = i % 10; b i % 10 i 10 if(a != b) continue; a != b a b continue; a = (i / 1000)% 10 a (i / 1000)% 10 (i / 1000) i 1000 10 b = (i / 10) % 10 b (i / 10) % 10 (i / 10) i 10 10 if(a == b) count++; a == b a b 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 = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());
    int count = 0;
    
    for(int i = A; i <= B; i++){
    	int a = i / 10000;
        int b = i % 10;
        if(a != b) continue;
      	a = (i / 1000)% 10;
        b = (i / 10) % 10;
        if(a == b) count++;
    }
    System.out.println(count);
  }
} public class Main{
  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 count = 0;
    
    for(int i = A; i <= B; i++){
    	int a = i / 10000;
        int b = i % 10;
        if(a != b) continue;
      	a = (i / 1000)% 10;
        b = (i / 10) % 10;
        if(a == b) count++;
    }
    System.out.println(count);
  }
} Main
import java.util.Scanner;
public class Main{
  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 count = 0;
    
    for(int i = A; i <= B; i++){
    	int a = i / 10000;
        int b = i % 10;
        if(a != b) continue;
      	a = (i / 1000)% 10;
        b = (i / 10) % 10;
        if(a == b) count++;
    }
    System.out.println(count);
  }
}


