import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int A = scan.nextInt();
	int B = scan.nextInt();

	int count = 0;
	for(int i = A; i <= B; i++){
	    String s = String.valueOf(i);
	    if(s.charAt(0) == s.charAt(4) &&
	       s.charAt(1) == s.charAt(3))
		count++;
	}

	System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int A = scan.nextInt();
	int B = scan.nextInt();

	int count = 0;
	for(int i = A; i <= B; i++){
	    String s = String.valueOf(i);
	    if(s.charAt(0) == s.charAt(4) &&
	       s.charAt(1) == s.charAt(3))
		count++;
	}

	System.out.println(count);
    }
} Main public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int A = scan.nextInt();
	int B = scan.nextInt();

	int count = 0;
	for(int i = A; i <= B; i++){
	    String s = String.valueOf(i);
	    if(s.charAt(0) == s.charAt(4) &&
	       s.charAt(1) == s.charAt(3))
		count++;
	}

	System.out.println(count);
    } main {
	Scanner scan = new Scanner(System.in);

	int A = scan.nextInt();
	int B = scan.nextInt();

	int count = 0;
	for(int i = A; i <= B; i++){
	    String s = String.valueOf(i);
	    if(s.charAt(0) == s.charAt(4) &&
	       s.charAt(1) == s.charAt(3))
		count++;
	}

	System.out.println(count);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int A = scan.nextInt(); A scan.nextInt() scan.nextInt scan int B = scan.nextInt(); B scan.nextInt() scan.nextInt scan int count = 0; count 0 for(int i = A; i <= B; i++){
	    String s = String.valueOf(i);
	    if(s.charAt(0) == s.charAt(4) &&
	       s.charAt(1) == s.charAt(3))
		count++;
	} int i = A; int i = A; i A i <= B i B i++ i++ i {
	    String s = String.valueOf(i);
	    if(s.charAt(0) == s.charAt(4) &&
	       s.charAt(1) == s.charAt(3))
		count++;
	} {
	    String s = String.valueOf(i);
	    if(s.charAt(0) == s.charAt(4) &&
	       s.charAt(1) == s.charAt(3))
		count++;
	} String s = String.valueOf(i); s String.valueOf(i) String.valueOf String i if(s.charAt(0) == s.charAt(4) &&
	       s.charAt(1) == s.charAt(3))
		count++; s.charAt(0) == s.charAt(4) &&
	       s.charAt(1) == s.charAt(3) s.charAt(0) == s.charAt(4) s.charAt(0) s.charAt s 0 s.charAt(4) s.charAt s 4 s.charAt(1) == s.charAt(3) s.charAt(1) s.charAt s 1 s.charAt(3) s.charAt s 3 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 scan = new Scanner(System.in);

	int A = scan.nextInt();
	int B = scan.nextInt();

	int count = 0;
	for(int i = A; i <= B; i++){
	    String s = String.valueOf(i);
	    if(s.charAt(0) == s.charAt(4) &&
	       s.charAt(1) == s.charAt(3))
		count++;
	}

	System.out.println(count);
    }
} public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int A = scan.nextInt();
	int B = scan.nextInt();

	int count = 0;
	for(int i = A; i <= B; i++){
	    String s = String.valueOf(i);
	    if(s.charAt(0) == s.charAt(4) &&
	       s.charAt(1) == s.charAt(3))
		count++;
	}

	System.out.println(count);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int A = scan.nextInt();
	int B = scan.nextInt();

	int count = 0;
	for(int i = A; i <= B; i++){
	    String s = String.valueOf(i);
	    if(s.charAt(0) == s.charAt(4) &&
	       s.charAt(1) == s.charAt(3))
		count++;
	}

	System.out.println(count);
    }
}
