#include <iostream>
using namespace std;
int main() {
// Новый шкаф
double a, b, x, y, z;
cin >> a >> b >> x >> y >> z;
if ((x < a && y < b) || (y < a && x < b) || (y < a && z < b) ||
(z < a && y < b) || (x < a && z < b) || (z < a && x < b)) {
cout << 1;
} else {
cout << 0;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCmludCBtYWluKCkgewoJLy8g0J3QvtCy0YvQuSDRiNC60LDRhAoJZG91YmxlIGEsIGIsIHgsIHksIHo7CgljaW4gPj4gYSA+PiBiID4+IHggPj4geSA+PiB6OwoJaWYgKCh4IDwgYSAmJiB5IDwgYikgfHwgKHkgPCBhICYmIHggPCBiKSB8fCAoeSA8IGEgJiYgeiA8IGIpIHx8IAoJKHogPCBhICYmIHkgPCBiKSB8fCAoeCA8IGEgJiYgeiA8IGIpIHx8ICh6IDwgYSAmJiB4IDwgYikpIHsKCQljb3V0IDw8IDE7Cgl9IGVsc2UgewoJCWNvdXQgPDwgMDsKCX0KCXJldHVybiAwOwp9