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