import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int cnt=0;
		for(int i=a;i<=b;i++) {
			//n1: iを反転した１つ目の桁
			int n1 = i%10,n5=i/10000%10;
			int n2 = i/10%10,n4=i/1000%10;
			if(n1==n5&&n2==n4)cnt++;
		}
		System.out.println(cnt);
		sc.close();
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int cnt=0;
		for(int i=a;i<=b;i++) {
			//n1: iを反転した１つ目の桁
			int n1 = i%10,n5=i/10000%10;
			int n2 = i/10%10,n4=i/1000%10;
			if(n1==n5&&n2==n4)cnt++;
		}
		System.out.println(cnt);
		sc.close();
	}

} Main public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	} main {
		Main main = new Main();
		main.solve();
	} Main main = new Main(); main new Main() main.solve() main.solve main String[] args args void solve() {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int cnt=0;
		for(int i=a;i<=b;i++) {
			//n1: iを反転した１つ目の桁
			int n1 = i%10,n5=i/10000%10;
			int n2 = i/10%10,n4=i/1000%10;
			if(n1==n5&&n2==n4)cnt++;
		}
		System.out.println(cnt);
		sc.close();
	} solve {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int cnt=0;
		for(int i=a;i<=b;i++) {
			//n1: iを反転した１つ目の桁
			int n1 = i%10,n5=i/10000%10;
			int n2 = i/10%10,n4=i/1000%10;
			if(n1==n5&&n2==n4)cnt++;
		}
		System.out.println(cnt);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = Integer.parseInt(sc.next()); a Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int b = Integer.parseInt(sc.next()); b Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int cnt=0; cnt 0 for(int i=a;i<=b;i++) {
			//n1: iを反転した１つ目の桁
			int n1 = i%10,n5=i/10000%10;
			int n2 = i/10%10,n4=i/1000%10;
			if(n1==n5&&n2==n4)cnt++;
		} int i=a; int i=a; i a i<=b i b i++ i++ i {
			//n1: iを反転した１つ目の桁
			int n1 = i%10,n5=i/10000%10;
			int n2 = i/10%10,n4=i/1000%10;
			if(n1==n5&&n2==n4)cnt++;
		} {
			//n1: iを反転した１つ目の桁
			int n1 = i%10,n5=i/10000%10;
			int n2 = i/10%10,n4=i/1000%10;
			if(n1==n5&&n2==n4)cnt++;
		} int n1 = i%10 n1 i%10 i 10 n5=i/10000%10; n5 i/10000%10 i/10000 i 10000 10 int n2 = i/10%10 n2 i/10%10 i/10 i 10 10 n4=i/1000%10; n4 i/1000%10 i/1000 i 1000 10 if(n1==n5&&n2==n4)cnt++; n1==n5&&n2==n4 n1==n5 n1 n5 n2==n4 n2 n4 cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt sc.close() sc.close sc public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int cnt=0;
		for(int i=a;i<=b;i++) {
			//n1: iを反転した１つ目の桁
			int n1 = i%10,n5=i/10000%10;
			int n2 = i/10%10,n4=i/1000%10;
			if(n1==n5&&n2==n4)cnt++;
		}
		System.out.println(cnt);
		sc.close();
	}

} public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int cnt=0;
		for(int i=a;i<=b;i++) {
			//n1: iを反転した１つ目の桁
			int n1 = i%10,n5=i/10000%10;
			int n2 = i/10%10,n4=i/1000%10;
			if(n1==n5&&n2==n4)cnt++;
		}
		System.out.println(cnt);
		sc.close();
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int cnt=0;
		for(int i=a;i<=b;i++) {
			//n1: iを反転した１つ目の桁
			int n1 = i%10,n5=i/10000%10;
			int n2 = i/10%10,n4=i/1000%10;
			if(n1==n5&&n2==n4)cnt++;
		}
		System.out.println(cnt);
		sc.close();
	}

}
