// Arup Guha
// 3/24/2015
// Solution to 2014 USACO Open Bronze Problem: Odometer

import java.util.*;
import java.io.*;

public class odometer {


	public static void main(String[] args) throws Exception {

		Scanner stdin = new Scanner(new File("odometer.in"));
		long start = stdin.nextLong();
		long end = stdin.nextLong();

		int res = solve(end) - solve(start-1);

		// Write out the result.
		FileWriter fout = new FileWriter(new File("odometer.out"));
		fout.write(res+"\n");
		fout.close();
	}

	public static int solve(long limit) {

		int numDigits = getNumDigits(limit);

		// Note: We're skipping over 2 digit solutions because they would always
		//       get subtracted out!!!
		if (numDigits < 3) return 0;

		int res = 0;

		// Add in all solutions of a particular number of digits.
		for (int i=3; i<numDigits; i++)
			res += sols(i);

		// Now list all possible solutions of size numDigits.
		String[] allSols = getAllSols(numDigits);

		// Number of regions.
		return res + numAtOrBelow(allSols, ""+limit);
	}

	// Returns all solutions with n digits.
	public static String[] getAllSols(int n) {

		String[] res = new String[9*9*n];
		int index = 0;

		// i = MSD, j = rest.
		for (int i=1; i<10; i++) {
			for (int j=0; j<10; j++) {
				if (i == j) continue;

				// k = location from left of minority digit.
				for (int k=0; k<n; k++) {

					char[] tmp = new char[n];

					// Fill in majority digit.
					if (k == 0) Arrays.fill(tmp, (char)('0'+j));
					else        Arrays.fill(tmp, (char)('0'+i));

					// Fill in minority digit;
					if (k == 0) tmp[k] = (char)('0'+i);
					else        tmp[k] = (char)('0'+j);

					// Store it!
					res[index++] = new String(tmp);
				}
			}
		}

		// Here they all are.
		return res;
	}

	// Pretty cool that string compare works here!
	public static int numAtOrBelow(String[] all, String limit) {
		int res = 0;
		for (int i=0; i<all.length; i++)
			if (all[i].compareTo(limit) <= 0)
				res++;
		return res;
	}

	// First digit has 9 choices. Let it be the minority digit. Then there are 9 choices for the rest.
	// Now, let it be the majority digit. There are 9 still choice for the other digit, but it can also
	// be placed in numDigit-1 places.
	public static int sols(int numDigits) {
		return 9*9 + 9*9*(numDigits-1);
	}

	public static int getNumDigits(long n) {

		// Divide out until digits are gone.
		int res = 0;
		while (n > 0) {
			n /= 10L;
			res ++;
		}
		return res;
	}
}