#include using namespace std; main(){int a,b,c,d,e,f;cin>>a>>b>>c>>d>>e>>f;a=max(a,d);c=max(c,f);b=min(b,e);cout<<(a>b&&b