#include <bits/stdc++.h>
using namespace std;
char sx[100]={0};
int main() {
memset(sx,0,strlen(sx));
long long a=0,b=0,c=0,d=0;
char ls=0;
long long sx=0,sy=0;
cin>>sx>>ls>>sy;
a=sx/10;
b=sx%10;
c=sy/10;
d=sy%10;
int out=0;
if(a>1){
a=1;
out=out+1;
}
if(a*10+b==2){
if(c*10+d>28){
c=1;
out=out+1;
}
}else{
if(b<7){
if(b%2==0){
if(c*10+d>30){
c=1;
out=out+1;
}
}else{
if(c*10+d>31){
c=1;
out=out+1;
}
}
}else{
if(b%2==0){
if(c*10+d>31){
c=1;
out=out+1;
}
}else{
if(c*10+d>30){
c=1;
out=out+1;
}
}
}
}
cout<<out;
return 0;
}