Boolean
Boolean-36
Boolean-37
Boolean-38
~/algor $ cat problems/boolean-kesmalar-kesishadimi
Do the segments intersect?
Medium
1000 ms
64 MB
38%
Two segments $[a; b]$ and $[c; d]$ are given on the number line. The ends of a segment belong to it too. Check whether the statement is true: “the segments have at least one common point”. For example, the segments $[1; 3]$ and $[3; 7]$ meet at the point $3$.
Input
One line with four integers: $a$, $b$, $c$ and $d$.
Output
One integer: $1$ if the statement is true, otherwise $0$.
Note
$-10^{9} \le a \le b \le 10^{9}$
$-10^{9} \le c \le d \le 10^{9}$
Examples
Input #1
1 5 3 8
Output #1
1
Input #2
1 2 4 6
Output #2
0