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 res = 0;
		for (int i=A; i<=B; i++) {
			int l1 = i%10; int l2 = i/10000%10;
			int f1 = i/10%10; int f2 = i/1000%10;
			if ( l1 == l2 && f1 == f2) res ++;
		}
		System.out.println(res);
	}
} 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 res = 0;
		for (int i=A; i<=B; i++) {
			int l1 = i%10; int l2 = i/10000%10;
			int f1 = i/10%10; int f2 = i/1000%10;
			if ( l1 == l2 && f1 == f2) res ++;
		}
		System.out.println(res);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int res = 0;
		for (int i=A; i<=B; i++) {
			int l1 = i%10; int l2 = i/10000%10;
			int f1 = i/10%10; int f2 = i/1000%10;
			if ( l1 == l2 && f1 == f2) res ++;
		}
		System.out.println(res);
	} main {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int res = 0;
		for (int i=A; i<=B; i++) {
			int l1 = i%10; int l2 = i/10000%10;
			int f1 = i/10%10; int f2 = i/1000%10;
			if ( l1 == l2 && f1 == f2) res ++;
		}
		System.out.println(res);
	} 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 res = 0; res 0 for (int i=A; i<=B; i++) {
			int l1 = i%10; int l2 = i/10000%10;
			int f1 = i/10%10; int f2 = i/1000%10;
			if ( l1 == l2 && f1 == f2) res ++;
		} int i=A; int i=A; i A i<=B i B i++ i++ i {
			int l1 = i%10; int l2 = i/10000%10;
			int f1 = i/10%10; int f2 = i/1000%10;
			if ( l1 == l2 && f1 == f2) res ++;
		} {
			int l1 = i%10; int l2 = i/10000%10;
			int f1 = i/10%10; int f2 = i/1000%10;
			if ( l1 == l2 && f1 == f2) res ++;
		} int l1 = i%10; l1 i%10 i 10 int l2 = i/10000%10; l2 i/10000%10 i/10000 i 10000 10 int f1 = i/10%10; f1 i/10%10 i/10 i 10 10 int f2 = i/1000%10; f2 i/1000%10 i/1000 i 1000 10 if ( l1 == l2 && f1 == f2) res ++; l1 == l2 && f1 == f2 l1 == l2 l1 l2 f1 == f2 f1 f2 res ++ res System.out.println(res) System.out.println System.out System System.out res 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 res = 0;
		for (int i=A; i<=B; i++) {
			int l1 = i%10; int l2 = i/10000%10;
			int f1 = i/10%10; int f2 = i/1000%10;
			if ( l1 == l2 && f1 == f2) res ++;
		}
		System.out.println(res);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int res = 0;
		for (int i=A; i<=B; i++) {
			int l1 = i%10; int l2 = i/10000%10;
			int f1 = i/10%10; int f2 = i/1000%10;
			if ( l1 == l2 && f1 == f2) res ++;
		}
		System.out.println(res);
	}
} 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 res = 0;
		for (int i=A; i<=B; i++) {
			int l1 = i%10; int l2 = i/10000%10;
			int f1 = i/10%10; int f2 = i/1000%10;
			if ( l1 == l2 && f1 == f2) res ++;
		}
		System.out.println(res);
	}
}