

import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		int count = 0;
		for(int i = a; i <= b; i++){
			char str[] = Integer.toString(i).toCharArray();

			if(str[0] == str[4] && str[1] == str[3]){
				count++;
			}
		}

		System.out.println(count);
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		int count = 0;
		for(int i = a; i <= b; i++){
			char str[] = Integer.toString(i).toCharArray();

			if(str[0] == str[4] && str[1] == str[3]){
				count++;
			}
		}

		System.out.println(count);
	}
} Main public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		int count = 0;
		for(int i = a; i <= b; i++){
			char str[] = Integer.toString(i).toCharArray();

			if(str[0] == str[4] && str[1] == str[3]){
				count++;
			}
		}

		System.out.println(count);
	} main {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		int count = 0;
		for(int i = a; i <= b; i++){
			char str[] = Integer.toString(i).toCharArray();

			if(str[0] == str[4] && str[1] == str[3]){
				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 count = 0; count 0 for(int i = a; i <= b; i++){
			char str[] = Integer.toString(i).toCharArray();

			if(str[0] == str[4] && str[1] == str[3]){
				count++;
			}
		} int i = a; int i = a; i a i <= b i b i++ i++ i {
			char str[] = Integer.toString(i).toCharArray();

			if(str[0] == str[4] && str[1] == str[3]){
				count++;
			}
		} {
			char str[] = Integer.toString(i).toCharArray();

			if(str[0] == str[4] && str[1] == str[3]){
				count++;
			}
		} char str[] = Integer.toString(i).toCharArray(); str Integer.toString(i).toCharArray() Integer.toString(i).toCharArray Integer.toString(i) Integer.toString Integer i if(str[0] == str[4] && str[1] == str[3]){
				count++;
			} str[0] == str[4] && str[1] == str[3] str[0] == str[4] str[0] str 0 str[4] str 4 str[1] == str[3] str[1] str 1 str[3] str 3 {
				count++;
			} 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) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		int count = 0;
		for(int i = a; i <= b; i++){
			char str[] = Integer.toString(i).toCharArray();

			if(str[0] == str[4] && str[1] == str[3]){
				count++;
			}
		}

		System.out.println(count);
	}
} public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		int count = 0;
		for(int i = a; i <= b; i++){
			char str[] = Integer.toString(i).toCharArray();

			if(str[0] == str[4] && str[1] == str[3]){
				count++;
			}
		}

		System.out.println(count);
	}
} Main


import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		int count = 0;
		for(int i = a; i <= b; i++){
			char str[] = Integer.toString(i).toCharArray();

			if(str[0] == str[4] && str[1] == str[3]){
				count++;
			}
		}

		System.out.println(count);
	}
}
