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 cnt = 0;

		for (int i = A; i <= B; i++) {

			if(Digits(i)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}

	public static boolean Digits(int n) {

		int digit[] = new int[5];

		for (int i = 0; i < 5; i++) {
			digit[i] = n % 10;
			n /= 10;
		}

		if(digit[0] == digit[4]
				&& digit[1] == digit[3]) {
			return true;
		} else {
			return false;
		}
	}
} 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 cnt = 0;

		for (int i = A; i <= B; i++) {

			if(Digits(i)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}

	public static boolean Digits(int n) {

		int digit[] = new int[5];

		for (int i = 0; i < 5; i++) {
			digit[i] = n % 10;
			n /= 10;
		}

		if(digit[0] == digit[4]
				&& digit[1] == digit[3]) {
			return true;
		} else {
			return false;
		}
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

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

		int cnt = 0;

		for (int i = A; i <= B; i++) {

			if(Digits(i)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	} main {

		Scanner sc = new Scanner(System.in);

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

		int cnt = 0;

		for (int i = A; i <= B; i++) {

			if(Digits(i)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	} 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 cnt = 0; cnt 0 for (int i = A; i <= B; i++) {

			if(Digits(i)) {
				cnt++;
			}
		} int i = A; int i = A; i A i <= B i B i++ i++ i {

			if(Digits(i)) {
				cnt++;
			}
		} {

			if(Digits(i)) {
				cnt++;
			}
		} if(Digits(i)) {
				cnt++;
			} Digits(i) Digits i {
				cnt++;
			} cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public static boolean Digits(int n) {

		int digit[] = new int[5];

		for (int i = 0; i < 5; i++) {
			digit[i] = n % 10;
			n /= 10;
		}

		if(digit[0] == digit[4]
				&& digit[1] == digit[3]) {
			return true;
		} else {
			return false;
		}
	} Digits {

		int digit[] = new int[5];

		for (int i = 0; i < 5; i++) {
			digit[i] = n % 10;
			n /= 10;
		}

		if(digit[0] == digit[4]
				&& digit[1] == digit[3]) {
			return true;
		} else {
			return false;
		}
	} int digit[] = new int[5]; digit new int[5] 5 for (int i = 0; i < 5; i++) {
			digit[i] = n % 10;
			n /= 10;
		} int i = 0; int i = 0; i 0 i < 5 i 5 i++ i++ i {
			digit[i] = n % 10;
			n /= 10;
		} {
			digit[i] = n % 10;
			n /= 10;
		} digit[i] = n % 10 digit[i] digit i n % 10 n 10 n /= 10 n 10 if(digit[0] == digit[4]
				&& digit[1] == digit[3]) {
			return true;
		} else {
			return false;
		} digit[0] == digit[4]
				&& digit[1] == digit[3] digit[0] == digit[4] digit[0] digit 0 digit[4] digit 4 digit[1] == digit[3] digit[1] digit 1 digit[3] digit 3 {
			return true;
		} return true; true {
			return false;
		} return false; false int n n public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

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

		int cnt = 0;

		for (int i = A; i <= B; i++) {

			if(Digits(i)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}

	public static boolean Digits(int n) {

		int digit[] = new int[5];

		for (int i = 0; i < 5; i++) {
			digit[i] = n % 10;
			n /= 10;
		}

		if(digit[0] == digit[4]
				&& digit[1] == digit[3]) {
			return true;
		} else {
			return false;
		}
	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

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

		int cnt = 0;

		for (int i = A; i <= B; i++) {

			if(Digits(i)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}

	public static boolean Digits(int n) {

		int digit[] = new int[5];

		for (int i = 0; i < 5; i++) {
			digit[i] = n % 10;
			n /= 10;
		}

		if(digit[0] == digit[4]
				&& digit[1] == digit[3]) {
			return true;
		} else {
			return false;
		}
	}
} 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 cnt = 0;

		for (int i = A; i <= B; i++) {

			if(Digits(i)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}

	public static boolean Digits(int n) {

		int digit[] = new int[5];

		for (int i = 0; i < 5; i++) {
			digit[i] = n % 10;
			n /= 10;
		}

		if(digit[0] == digit[4]
				&& digit[1] == digit[3]) {
			return true;
		} else {
			return false;
		}
	}
}
