import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 入力値を取得
		Integer a = sc.nextInt();
		Integer b = sc.nextInt();
		// 回文数列を作成
		List<Integer> kaibun = new ArrayList<Integer>();
		for(int i = 1; i <= 9 ; i++){
			String value = String.valueOf(i);
			String tmpStr = value + "000" + value;
			Integer tmpInt = Integer.parseInt(tmpStr);
			kaibun.add(tmpInt);
			for(int j = 1; j <= 9 ; j++){
				String value2 = String.valueOf(j);
				String tmpStr2 = value + "0" +value2 + "0" + value;
				String tmpStr3 = value + value2 + "0" + value2 + value;
				Integer tmpInt2 = Integer.parseInt(tmpStr2);
				Integer tmpInt3 = Integer.parseInt(tmpStr3);
				kaibun.add(tmpInt2);
				kaibun.add(tmpInt3);
				for(int k = 1; k <= 9 ; k++){
					String value3 = String.valueOf(k);
					String tmpStr4 = value + value2 + value3 + value2 + value;
					Integer tmpInt4 = Integer.parseInt(tmpStr4);
					kaibun.add(tmpInt4);
				}
			}
		}
		Collections.sort(kaibun);
		kaibun = kaibun.stream().distinct().collect(Collectors.toList());
		int startIndex = 0;
		int endIndex = 0;
		for(int i = 0; i < kaibun.size(); i++){
			if(a <= kaibun.get(i)){
				startIndex = i;
				break;
			}
		}
		for(int j = startIndex; j < kaibun.size(); j++){
			if(b < kaibun.get(j)){
				endIndex = j -1;
				break;
			}else if(b.equals(kaibun.get(j))){
				endIndex = j;
				break;
			}
		}
		int count = endIndex - startIndex + 1;
		System.out.println(count);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util import java.util.stream.Collectors; Collectors java.util.stream class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 入力値を取得
		Integer a = sc.nextInt();
		Integer b = sc.nextInt();
		// 回文数列を作成
		List<Integer> kaibun = new ArrayList<Integer>();
		for(int i = 1; i <= 9 ; i++){
			String value = String.valueOf(i);
			String tmpStr = value + "000" + value;
			Integer tmpInt = Integer.parseInt(tmpStr);
			kaibun.add(tmpInt);
			for(int j = 1; j <= 9 ; j++){
				String value2 = String.valueOf(j);
				String tmpStr2 = value + "0" +value2 + "0" + value;
				String tmpStr3 = value + value2 + "0" + value2 + value;
				Integer tmpInt2 = Integer.parseInt(tmpStr2);
				Integer tmpInt3 = Integer.parseInt(tmpStr3);
				kaibun.add(tmpInt2);
				kaibun.add(tmpInt3);
				for(int k = 1; k <= 9 ; k++){
					String value3 = String.valueOf(k);
					String tmpStr4 = value + value2 + value3 + value2 + value;
					Integer tmpInt4 = Integer.parseInt(tmpStr4);
					kaibun.add(tmpInt4);
				}
			}
		}
		Collections.sort(kaibun);
		kaibun = kaibun.stream().distinct().collect(Collectors.toList());
		int startIndex = 0;
		int endIndex = 0;
		for(int i = 0; i < kaibun.size(); i++){
			if(a <= kaibun.get(i)){
				startIndex = i;
				break;
			}
		}
		for(int j = startIndex; j < kaibun.size(); j++){
			if(b < kaibun.get(j)){
				endIndex = j -1;
				break;
			}else if(b.equals(kaibun.get(j))){
				endIndex = j;
				break;
			}
		}
		int count = endIndex - startIndex + 1;
		System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 入力値を取得
		Integer a = sc.nextInt();
		Integer b = sc.nextInt();
		// 回文数列を作成
		List<Integer> kaibun = new ArrayList<Integer>();
		for(int i = 1; i <= 9 ; i++){
			String value = String.valueOf(i);
			String tmpStr = value + "000" + value;
			Integer tmpInt = Integer.parseInt(tmpStr);
			kaibun.add(tmpInt);
			for(int j = 1; j <= 9 ; j++){
				String value2 = String.valueOf(j);
				String tmpStr2 = value + "0" +value2 + "0" + value;
				String tmpStr3 = value + value2 + "0" + value2 + value;
				Integer tmpInt2 = Integer.parseInt(tmpStr2);
				Integer tmpInt3 = Integer.parseInt(tmpStr3);
				kaibun.add(tmpInt2);
				kaibun.add(tmpInt3);
				for(int k = 1; k <= 9 ; k++){
					String value3 = String.valueOf(k);
					String tmpStr4 = value + value2 + value3 + value2 + value;
					Integer tmpInt4 = Integer.parseInt(tmpStr4);
					kaibun.add(tmpInt4);
				}
			}
		}
		Collections.sort(kaibun);
		kaibun = kaibun.stream().distinct().collect(Collectors.toList());
		int startIndex = 0;
		int endIndex = 0;
		for(int i = 0; i < kaibun.size(); i++){
			if(a <= kaibun.get(i)){
				startIndex = i;
				break;
			}
		}
		for(int j = startIndex; j < kaibun.size(); j++){
			if(b < kaibun.get(j)){
				endIndex = j -1;
				break;
			}else if(b.equals(kaibun.get(j))){
				endIndex = j;
				break;
			}
		}
		int count = endIndex - startIndex + 1;
		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		// 入力値を取得
		Integer a = sc.nextInt();
		Integer b = sc.nextInt();
		// 回文数列を作成
		List<Integer> kaibun = new ArrayList<Integer>();
		for(int i = 1; i <= 9 ; i++){
			String value = String.valueOf(i);
			String tmpStr = value + "000" + value;
			Integer tmpInt = Integer.parseInt(tmpStr);
			kaibun.add(tmpInt);
			for(int j = 1; j <= 9 ; j++){
				String value2 = String.valueOf(j);
				String tmpStr2 = value + "0" +value2 + "0" + value;
				String tmpStr3 = value + value2 + "0" + value2 + value;
				Integer tmpInt2 = Integer.parseInt(tmpStr2);
				Integer tmpInt3 = Integer.parseInt(tmpStr3);
				kaibun.add(tmpInt2);
				kaibun.add(tmpInt3);
				for(int k = 1; k <= 9 ; k++){
					String value3 = String.valueOf(k);
					String tmpStr4 = value + value2 + value3 + value2 + value;
					Integer tmpInt4 = Integer.parseInt(tmpStr4);
					kaibun.add(tmpInt4);
				}
			}
		}
		Collections.sort(kaibun);
		kaibun = kaibun.stream().distinct().collect(Collectors.toList());
		int startIndex = 0;
		int endIndex = 0;
		for(int i = 0; i < kaibun.size(); i++){
			if(a <= kaibun.get(i)){
				startIndex = i;
				break;
			}
		}
		for(int j = startIndex; j < kaibun.size(); j++){
			if(b < kaibun.get(j)){
				endIndex = j -1;
				break;
			}else if(b.equals(kaibun.get(j))){
				endIndex = j;
				break;
			}
		}
		int count = endIndex - startIndex + 1;
		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Integer a = sc.nextInt(); a sc.nextInt() sc.nextInt sc Integer b = sc.nextInt(); b sc.nextInt() sc.nextInt sc List<Integer> kaibun = new ArrayList<Integer>(); kaibun new ArrayList<Integer>() for(int i = 1; i <= 9 ; i++){
			String value = String.valueOf(i);
			String tmpStr = value + "000" + value;
			Integer tmpInt = Integer.parseInt(tmpStr);
			kaibun.add(tmpInt);
			for(int j = 1; j <= 9 ; j++){
				String value2 = String.valueOf(j);
				String tmpStr2 = value + "0" +value2 + "0" + value;
				String tmpStr3 = value + value2 + "0" + value2 + value;
				Integer tmpInt2 = Integer.parseInt(tmpStr2);
				Integer tmpInt3 = Integer.parseInt(tmpStr3);
				kaibun.add(tmpInt2);
				kaibun.add(tmpInt3);
				for(int k = 1; k <= 9 ; k++){
					String value3 = String.valueOf(k);
					String tmpStr4 = value + value2 + value3 + value2 + value;
					Integer tmpInt4 = Integer.parseInt(tmpStr4);
					kaibun.add(tmpInt4);
				}
			}
		} int i = 1; int i = 1; i 1 i <= 9 i 9 i++ i++ i {
			String value = String.valueOf(i);
			String tmpStr = value + "000" + value;
			Integer tmpInt = Integer.parseInt(tmpStr);
			kaibun.add(tmpInt);
			for(int j = 1; j <= 9 ; j++){
				String value2 = String.valueOf(j);
				String tmpStr2 = value + "0" +value2 + "0" + value;
				String tmpStr3 = value + value2 + "0" + value2 + value;
				Integer tmpInt2 = Integer.parseInt(tmpStr2);
				Integer tmpInt3 = Integer.parseInt(tmpStr3);
				kaibun.add(tmpInt2);
				kaibun.add(tmpInt3);
				for(int k = 1; k <= 9 ; k++){
					String value3 = String.valueOf(k);
					String tmpStr4 = value + value2 + value3 + value2 + value;
					Integer tmpInt4 = Integer.parseInt(tmpStr4);
					kaibun.add(tmpInt4);
				}
			}
		} {
			String value = String.valueOf(i);
			String tmpStr = value + "000" + value;
			Integer tmpInt = Integer.parseInt(tmpStr);
			kaibun.add(tmpInt);
			for(int j = 1; j <= 9 ; j++){
				String value2 = String.valueOf(j);
				String tmpStr2 = value + "0" +value2 + "0" + value;
				String tmpStr3 = value + value2 + "0" + value2 + value;
				Integer tmpInt2 = Integer.parseInt(tmpStr2);
				Integer tmpInt3 = Integer.parseInt(tmpStr3);
				kaibun.add(tmpInt2);
				kaibun.add(tmpInt3);
				for(int k = 1; k <= 9 ; k++){
					String value3 = String.valueOf(k);
					String tmpStr4 = value + value2 + value3 + value2 + value;
					Integer tmpInt4 = Integer.parseInt(tmpStr4);
					kaibun.add(tmpInt4);
				}
			}
		} String value = String.valueOf(i); value String.valueOf(i) String.valueOf String i String tmpStr = value + "000" + value; tmpStr value + "000" + value value + "000" + value value "000" value Integer tmpInt = Integer.parseInt(tmpStr); tmpInt Integer.parseInt(tmpStr) Integer.parseInt Integer tmpStr kaibun.add(tmpInt) kaibun.add kaibun tmpInt for(int j = 1; j <= 9 ; j++){
				String value2 = String.valueOf(j);
				String tmpStr2 = value + "0" +value2 + "0" + value;
				String tmpStr3 = value + value2 + "0" + value2 + value;
				Integer tmpInt2 = Integer.parseInt(tmpStr2);
				Integer tmpInt3 = Integer.parseInt(tmpStr3);
				kaibun.add(tmpInt2);
				kaibun.add(tmpInt3);
				for(int k = 1; k <= 9 ; k++){
					String value3 = String.valueOf(k);
					String tmpStr4 = value + value2 + value3 + value2 + value;
					Integer tmpInt4 = Integer.parseInt(tmpStr4);
					kaibun.add(tmpInt4);
				}
			} int j = 1; int j = 1; j 1 j <= 9 j 9 j++ j++ j {
				String value2 = String.valueOf(j);
				String tmpStr2 = value + "0" +value2 + "0" + value;
				String tmpStr3 = value + value2 + "0" + value2 + value;
				Integer tmpInt2 = Integer.parseInt(tmpStr2);
				Integer tmpInt3 = Integer.parseInt(tmpStr3);
				kaibun.add(tmpInt2);
				kaibun.add(tmpInt3);
				for(int k = 1; k <= 9 ; k++){
					String value3 = String.valueOf(k);
					String tmpStr4 = value + value2 + value3 + value2 + value;
					Integer tmpInt4 = Integer.parseInt(tmpStr4);
					kaibun.add(tmpInt4);
				}
			} {
				String value2 = String.valueOf(j);
				String tmpStr2 = value + "0" +value2 + "0" + value;
				String tmpStr3 = value + value2 + "0" + value2 + value;
				Integer tmpInt2 = Integer.parseInt(tmpStr2);
				Integer tmpInt3 = Integer.parseInt(tmpStr3);
				kaibun.add(tmpInt2);
				kaibun.add(tmpInt3);
				for(int k = 1; k <= 9 ; k++){
					String value3 = String.valueOf(k);
					String tmpStr4 = value + value2 + value3 + value2 + value;
					Integer tmpInt4 = Integer.parseInt(tmpStr4);
					kaibun.add(tmpInt4);
				}
			} String value2 = String.valueOf(j); value2 String.valueOf(j) String.valueOf String j String tmpStr2 = value + "0" +value2 + "0" + value; tmpStr2 value + "0" +value2 + "0" + value "0" value2 value + "0" +value2 + "0" + value value "0" value2 "0" value String tmpStr3 = value + value2 + "0" + value2 + value; tmpStr3 value + value2 + "0" + value2 + value value2 "0" value + value2 + "0" + value2 + value value value2 "0" value2 value Integer tmpInt2 = Integer.parseInt(tmpStr2); tmpInt2 Integer.parseInt(tmpStr2) Integer.parseInt Integer tmpStr2 Integer tmpInt3 = Integer.parseInt(tmpStr3); tmpInt3 Integer.parseInt(tmpStr3) Integer.parseInt Integer tmpStr3 kaibun.add(tmpInt2) kaibun.add kaibun tmpInt2 kaibun.add(tmpInt3) kaibun.add kaibun tmpInt3 for(int k = 1; k <= 9 ; k++){
					String value3 = String.valueOf(k);
					String tmpStr4 = value + value2 + value3 + value2 + value;
					Integer tmpInt4 = Integer.parseInt(tmpStr4);
					kaibun.add(tmpInt4);
				} int k = 1; int k = 1; k 1 k <= 9 k 9 k++ k++ k {
					String value3 = String.valueOf(k);
					String tmpStr4 = value + value2 + value3 + value2 + value;
					Integer tmpInt4 = Integer.parseInt(tmpStr4);
					kaibun.add(tmpInt4);
				} {
					String value3 = String.valueOf(k);
					String tmpStr4 = value + value2 + value3 + value2 + value;
					Integer tmpInt4 = Integer.parseInt(tmpStr4);
					kaibun.add(tmpInt4);
				} String value3 = String.valueOf(k); value3 String.valueOf(k) String.valueOf String k String tmpStr4 = value + value2 + value3 + value2 + value; tmpStr4 value + value2 + value3 + value2 + value value2 value3 value + value2 + value3 + value2 + value value value2 value3 value2 value Integer tmpInt4 = Integer.parseInt(tmpStr4); tmpInt4 Integer.parseInt(tmpStr4) Integer.parseInt Integer tmpStr4 kaibun.add(tmpInt4) kaibun.add kaibun tmpInt4 Collections.sort(kaibun) Collections.sort Collections kaibun kaibun = kaibun.stream().distinct().collect(Collectors.toList()) kaibun kaibun.stream().distinct().collect(Collectors.toList()) kaibun.stream().distinct().collect kaibun.stream().distinct() kaibun.stream().distinct kaibun.stream() kaibun.stream kaibun Collectors.toList() Collectors.toList Collectors int startIndex = 0; startIndex 0 int endIndex = 0; endIndex 0 for(int i = 0; i < kaibun.size(); i++){
			if(a <= kaibun.get(i)){
				startIndex = i;
				break;
			}
		} int i = 0; int i = 0; i 0 i < kaibun.size() i kaibun.size() kaibun.size kaibun i++ i++ i {
			if(a <= kaibun.get(i)){
				startIndex = i;
				break;
			}
		} {
			if(a <= kaibun.get(i)){
				startIndex = i;
				break;
			}
		} if(a <= kaibun.get(i)){
				startIndex = i;
				break;
			} a <= kaibun.get(i) a kaibun.get(i) kaibun.get kaibun i {
				startIndex = i;
				break;
			} startIndex = i startIndex i break; for(int j = startIndex; j < kaibun.size(); j++){
			if(b < kaibun.get(j)){
				endIndex = j -1;
				break;
			}else if(b.equals(kaibun.get(j))){
				endIndex = j;
				break;
			}
		} int j = startIndex; int j = startIndex; j startIndex j < kaibun.size() j kaibun.size() kaibun.size kaibun j++ j++ j {
			if(b < kaibun.get(j)){
				endIndex = j -1;
				break;
			}else if(b.equals(kaibun.get(j))){
				endIndex = j;
				break;
			}
		} {
			if(b < kaibun.get(j)){
				endIndex = j -1;
				break;
			}else if(b.equals(kaibun.get(j))){
				endIndex = j;
				break;
			}
		} if(b < kaibun.get(j)){
				endIndex = j -1;
				break;
			}else if(b.equals(kaibun.get(j))){
				endIndex = j;
				break;
			} b < kaibun.get(j) b kaibun.get(j) kaibun.get kaibun j {
				endIndex = j -1;
				break;
			} endIndex = j -1 endIndex j -1 j 1 break; if(b.equals(kaibun.get(j))){
				endIndex = j;
				break;
			} b.equals(kaibun.get(j)) b.equals b kaibun.get(j) kaibun.get kaibun j {
				endIndex = j;
				break;
			} endIndex = j endIndex j break; int count = endIndex - startIndex + 1; count endIndex - startIndex + 1 endIndex - startIndex endIndex startIndex 1 System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 入力値を取得
		Integer a = sc.nextInt();
		Integer b = sc.nextInt();
		// 回文数列を作成
		List<Integer> kaibun = new ArrayList<Integer>();
		for(int i = 1; i <= 9 ; i++){
			String value = String.valueOf(i);
			String tmpStr = value + "000" + value;
			Integer tmpInt = Integer.parseInt(tmpStr);
			kaibun.add(tmpInt);
			for(int j = 1; j <= 9 ; j++){
				String value2 = String.valueOf(j);
				String tmpStr2 = value + "0" +value2 + "0" + value;
				String tmpStr3 = value + value2 + "0" + value2 + value;
				Integer tmpInt2 = Integer.parseInt(tmpStr2);
				Integer tmpInt3 = Integer.parseInt(tmpStr3);
				kaibun.add(tmpInt2);
				kaibun.add(tmpInt3);
				for(int k = 1; k <= 9 ; k++){
					String value3 = String.valueOf(k);
					String tmpStr4 = value + value2 + value3 + value2 + value;
					Integer tmpInt4 = Integer.parseInt(tmpStr4);
					kaibun.add(tmpInt4);
				}
			}
		}
		Collections.sort(kaibun);
		kaibun = kaibun.stream().distinct().collect(Collectors.toList());
		int startIndex = 0;
		int endIndex = 0;
		for(int i = 0; i < kaibun.size(); i++){
			if(a <= kaibun.get(i)){
				startIndex = i;
				break;
			}
		}
		for(int j = startIndex; j < kaibun.size(); j++){
			if(b < kaibun.get(j)){
				endIndex = j -1;
				break;
			}else if(b.equals(kaibun.get(j))){
				endIndex = j;
				break;
			}
		}
		int count = endIndex - startIndex + 1;
		System.out.println(count);
	}
}