1 #include <cstdio>
2 #include <cmath>
3
4 int a, b;
5 int num[35];
6
7 bool find(int sum, int n) {
8 if(sum == 0) {
9 return true;
10 }
11 if(n < 0 || sum < 0) {
12 return false;
13 }
14 return find(sum,n-1) || find(sum-num[n],n-1);
15 }
16
17 bool isA(int m) {
18 int j = 0;
19 int sum = 0;
20 while(m >= 10) {
21 int mo = m % 10;
22 num[j++] = mo;
23 sum = sum + mo;
24 m = m/10;
25 }
26 num[j++] = m;
27 sum = sum + m;
28 if(sum&1) {
29 return false;
30 }
31 else {
32 int bsum = sum / 2;
33 return find(bsum, j-1);
34 }
35
36 }
37
38 int main() {
39 while(scanf("%d %d",&a, &b) != EOF) {
40 int cnt = 0;
41 for(int i = a; i <= b; i++) {
42 if(isA(i)) {
43 cnt++;
44 }
45 }
46 printf("%d\n",cnt);
47 }
48 return 0;
49 }