1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

 long long int  ToInt( char c)
        {
            return (long long int )(c - '0');
        }
        
int NumbOfDig(long long int _tmp)
{
	int digits = 0;
	while (_tmp) {
        _tmp /= 10;
        digits++;
    }
    return digits;
	
}
bool IsPotyczkow(long long int _tmp)
{
	char numb[16];
	snprintf(numb,16,"%ld",_tmp);
	for(int i=0;i<NumbOfDig(_tmp);i++)
	{
		if(numb[i]=='0') return false;
		if (_tmp % ToInt( numb[i]) != 0) return false;
	}
	return true;
	
}
int main()
{
	long long int r,l,counter=0,i;
	scanf ("%ld %ld",&r,&l);
	for(i=r;i<=l;i++)
	{
	if(IsPotyczkow(i)==true) counter++;
	}
	printf("%d", counter);	
	return 0;
}