#include<iostream>
using namespace std;
int month,day,tep;
int mon[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
char a;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>month>>a>>day;
if(month>12||month==0)
{
tep++;
if(month%10==2&&day==31)
month=12;
else
month%=10;
}
if(day>mon[month])
tep++;
if(day==0)
tep++;
cout<<tep;
return 0;
}