import java.util.Scanner;

public class Main{

	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int result = 0;
		int[] k = new int[5];
		
		for(int i = a; i <= b; i ++) {
			int n = i;
			for(int j = 0; j < 5; j ++) {
				k[j] = (n % 10);
				n = n / 10;
				}
			if(k[0] == k[4] && k[1] == k[3]) {
				result ++;
			}
		}
		System.out.println(result);
	}
} import java.util.Scanner; Scanner 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 result = 0;
		int[] k = new int[5];
		
		for(int i = a; i <= b; i ++) {
			int n = i;
			for(int j = 0; j < 5; j ++) {
				k[j] = (n % 10);
				n = n / 10;
				}
			if(k[0] == k[4] && k[1] == k[3]) {
				result ++;
			}
		}
		System.out.println(result);
	}
} Main public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int result = 0;
		int[] k = new int[5];
		
		for(int i = a; i <= b; i ++) {
			int n = i;
			for(int j = 0; j < 5; j ++) {
				k[j] = (n % 10);
				n = n / 10;
				}
			if(k[0] == k[4] && k[1] == k[3]) {
				result ++;
			}
		}
		System.out.println(result);
	} main {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int result = 0;
		int[] k = new int[5];
		
		for(int i = a; i <= b; i ++) {
			int n = i;
			for(int j = 0; j < 5; j ++) {
				k[j] = (n % 10);
				n = n / 10;
				}
			if(k[0] == k[4] && k[1] == k[3]) {
				result ++;
			}
		}
		System.out.println(result);
	} 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 result = 0; result 0 int[] k = new int[5]; k new int[5] 5 for(int i = a; i <= b; i ++) {
			int n = i;
			for(int j = 0; j < 5; j ++) {
				k[j] = (n % 10);
				n = n / 10;
				}
			if(k[0] == k[4] && k[1] == k[3]) {
				result ++;
			}
		} int i = a; int i = a; i a i <= b i b i ++ i ++ i {
			int n = i;
			for(int j = 0; j < 5; j ++) {
				k[j] = (n % 10);
				n = n / 10;
				}
			if(k[0] == k[4] && k[1] == k[3]) {
				result ++;
			}
		} {
			int n = i;
			for(int j = 0; j < 5; j ++) {
				k[j] = (n % 10);
				n = n / 10;
				}
			if(k[0] == k[4] && k[1] == k[3]) {
				result ++;
			}
		} int n = i; n i for(int j = 0; j < 5; j ++) {
				k[j] = (n % 10);
				n = n / 10;
				} int j = 0; int j = 0; j 0 j < 5 j 5 j ++ j ++ j {
				k[j] = (n % 10);
				n = n / 10;
				} {
				k[j] = (n % 10);
				n = n / 10;
				} k[j] = (n % 10) k[j] k j (n % 10) n 10 n = n / 10 n n / 10 n 10 if(k[0] == k[4] && k[1] == k[3]) {
				result ++;
			} k[0] == k[4] && k[1] == k[3] k[0] == k[4] k[0] k 0 k[4] k 4 k[1] == k[3] k[1] k 1 k[3] k 3 {
				result ++;
			} result ++ result System.out.println(result) System.out.println System.out System System.out result 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 result = 0;
		int[] k = new int[5];
		
		for(int i = a; i <= b; i ++) {
			int n = i;
			for(int j = 0; j < 5; j ++) {
				k[j] = (n % 10);
				n = n / 10;
				}
			if(k[0] == k[4] && k[1] == k[3]) {
				result ++;
			}
		}
		System.out.println(result);
	}
} public class Main{

	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int result = 0;
		int[] k = new int[5];
		
		for(int i = a; i <= b; i ++) {
			int n = i;
			for(int j = 0; j < 5; j ++) {
				k[j] = (n % 10);
				n = n / 10;
				}
			if(k[0] == k[4] && k[1] == k[3]) {
				result ++;
			}
		}
		System.out.println(result);
	}
} Main
import java.util.Scanner;

public class Main{

	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int result = 0;
		int[] k = new int[5];
		
		for(int i = a; i <= b; i ++) {
			int n = i;
			for(int j = 0; j < 5; j ++) {
				k[j] = (n % 10);
				n = n / 10;
				}
			if(k[0] == k[4] && k[1] == k[3]) {
				result ++;
			}
		}
		System.out.println(result);
	}
}
