#include<bits/stdc++.h>
using namespace std;
int main(){
int x,z;
cin>>x>>z;
if(x<60^z<60)
cout<<"1";
else
cout<<" 0";
return 0;}
#include<bits/stdc++.h>
using namespace std;
int main(){
int x,z;
cin>>x>>z;
if(x<60^z<60)
cout<<"1";
else
cout<<" 0";
return 0;}