eolymp
bolt
Try our new interface for solving problems
Problems

Transfer points

Transfer points

To unload the new avenue, it was decided to launch two new bus routes at different sections of the avenue. The final stops of each of the buses are known.

Determine the number of stops where you can change from one bus to another.

Input

Four numbers - the numbers of the final stops, first of the first, then of the second bus. Numbers do not exceed 109.

Output

Print the required number of stops.

Time limit 1 second
Memory limit 128 MiB
Input example #1
3 6 4 2
Output example #1
2