// Arup Guha
// 2/14/2021
// Solution to 2018 MCPC Problem: Heir's Dilemma

import java.util.*;

public class heirsdilemma {

	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		int a = stdin.nextInt();
		int b = stdin.nextInt();
		
		// Loop through the sample space, counting which numbers are possible.
		int res = 0;
		for (int i=a; i<=b; i++) {
			if (good(i)) res++;
		}
		System.out.println(res);
	
	}
	
	// Returns true iff n is a valid comob.
	public static boolean good(int n) {
	
		// Store the frequency of digits.
		int save = n;
		int[] freq = new int[10];
		for (int i=0; i<6; i++) {
			freq[n%10]++;
			n /= 10;
		}
		
		// 0 isn't allowed.
		if (freq[0] > 0) return false;
		
		// Just go through each digit.
		for (int i=0; i<10; i++) {
			
			// Not allowed a duplicate.
			if (freq[i] > 1)
				return false;
			
			// The number has this digit but isn't divisible, it's out.
			if (freq[i] == 1 && save%i != 0)
				return false;
		}
		
		// If we get here, we're good.
		return true;
	}
}