import 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 count = 0;
		for(int i = a; i <= b; i++) {
			int n5 = i / 10000;
			int n4 = (i / 1000) % 10;
			int n2 = (i / 10 ) % 10;
			int n1 = i % 10;
			if(n5 == n1 && n4 == n2) count++;			
		}
        System.out.println(count);
		}	
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int count = 0;
		for(int i = a; i <= b; i++) {
			int n5 = i / 10000;
			int n4 = (i / 1000) % 10;
			int n2 = (i / 10 ) % 10;
			int n1 = i % 10;
			if(n5 == n1 && n4 == n2) count++;			
		}
        System.out.println(count);
		}	
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int count = 0;
		for(int i = a; i <= b; i++) {
			int n5 = i / 10000;
			int n4 = (i / 1000) % 10;
			int n2 = (i / 10 ) % 10;
			int n1 = i % 10;
			if(n5 == n1 && n4 == n2) count++;			
		}
        System.out.println(count);
		} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int count = 0;
		for(int i = a; i <= b; i++) {
			int n5 = i / 10000;
			int n4 = (i / 1000) % 10;
			int n2 = (i / 10 ) % 10;
			int n1 = i % 10;
			if(n5 == n1 && n4 == n2) 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++) {
			int n5 = i / 10000;
			int n4 = (i / 1000) % 10;
			int n2 = (i / 10 ) % 10;
			int n1 = i % 10;
			if(n5 == n1 && n4 == n2) count++;			
		} int i = a; int i = a; i a i <= b i b i++ i++ i {
			int n5 = i / 10000;
			int n4 = (i / 1000) % 10;
			int n2 = (i / 10 ) % 10;
			int n1 = i % 10;
			if(n5 == n1 && n4 == n2) count++;			
		} {
			int n5 = i / 10000;
			int n4 = (i / 1000) % 10;
			int n2 = (i / 10 ) % 10;
			int n1 = i % 10;
			if(n5 == n1 && n4 == n2) count++;			
		} int n5 = i / 10000; n5 i / 10000 i 10000 int n4 = (i / 1000) % 10; n4 (i / 1000) % 10 (i / 1000) i 1000 10 int n2 = (i / 10 ) % 10; n2 (i / 10 ) % 10 (i / 10 ) i 10 10 int n1 = i % 10; n1 i % 10 i 10 if(n5 == n1 && n4 == n2) count++; n5 == n1 && n4 == n2 n5 == n1 n5 n1 n4 == n2 n4 n2 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) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int count = 0;
		for(int i = a; i <= b; i++) {
			int n5 = i / 10000;
			int n4 = (i / 1000) % 10;
			int n2 = (i / 10 ) % 10;
			int n1 = i % 10;
			if(n5 == n1 && n4 == n2) count++;			
		}
        System.out.println(count);
		}	
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int count = 0;
		for(int i = a; i <= b; i++) {
			int n5 = i / 10000;
			int n4 = (i / 1000) % 10;
			int n2 = (i / 10 ) % 10;
			int n1 = i % 10;
			if(n5 == n1 && n4 == n2) count++;			
		}
        System.out.println(count);
		}	
} Main
import 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 count = 0;
		for(int i = a; i <= b; i++) {
			int n5 = i / 10000;
			int n4 = (i / 1000) % 10;
			int n2 = (i / 10 ) % 10;
			int n1 = i % 10;
			if(n5 == n1 && n4 == n2) count++;			
		}
        System.out.println(count);
		}	
}
