#include<bits/stdc++.h>
using namespace std;
string ss;
int month,day,ans=0;
int main()
{
cin>>ss;
month=(ss[0]-'0')*10+(ss[1]-'0');
day=(ss[3]-'0')*10+(ss[4]-'0');
if(month>12)
{
ans++;
}
if(month%10==2)
{
if(day>28)
{
ans++;
}
}
if(month%10==1||month%10==3||month%10==5||month%10==7||month%10==8||month%10==10||month%10==12)
{
if(day>31)
{
ans++;
}
}
if(month%10==2||month%10==4||month%10==6||month%10==9||month%10==11)
{
if(day>30)
{
ans++;
}
}
cout<<ans<<endl;
return 0;
}