#include<bits/stdc++.h>
using namespace std;
bool judge(int n)
{
if(n%4!=0)return false;
else if(n%100==0&&n%400!=0)return false;
else return true;
}
int m,n,b=0,s=0;
bool flag=true;
int main()
{
cin>>m>>n;
for(int i=1900;i<=n;i++)
{
if(i==m)flag=false;
for(int j=1;j<=12;j++)
{
int q;
if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)q=31;
else if(judge(i)==true&&j==2)q=29;
else if(judge(i)==false&&j==2)q=28;
else q=30;
for(int k=1;k<=q;k++)
{
b++;
if(b>7)b-=7;
if(j==11&&k==11&&(b==6||b==7)&&flag==false)s++;
}
}
}
cout<<s;
return 0;
}