wenzhang @ 2017-11-06 21:49:50
#include<bits/stdc++.h>
using namespace std;
int hw(int x) {
int y=0;
while(x) {
y=y*10+x%10;
x/=10;
}
return y;
}
int pd(int a) {
int r=a%100,y=a/100;
if(y<=0||y>12||r<=0||r>31)return 0;
if(y==4||y==6||y==9||y==11&&r>30)return 0;
if(y==2&&r>29)return 0;
return 1;
}
int i,a,b,n,m,ans,a1,b1;
int main() {
scanf("%d%d",&a,&b);
n=a/10000;
m=b/10000;
a1=a%10000;
b1=b%10000;
if(hw(n)>=a1&&pd(hw(n)))ans++;
if(hw(m)<=b1&&pd(hw(m))&&n!=m)ans++;
for(i=n+1; i<m; i++)
if(pd(hw(i)))ans++;
printf("%d\n",ans);
return 0;
}