#D1692. Two Switches
Two Switches
Two Switches
Alice and Bob are controlling a robot. They each have one switch that controls the robot. Alice started holding down her button A second after the start-up of the robot, and released her button B second after the start-up. Bob started holding down his button C second after the start-up, and released his button D second after the start-up. For how many seconds both Alice and Bob were holding down their buttons?
Constraints
- 0≤A<B≤100
- 0≤C<D≤100
- All input values are integers.
Input
Input is given from Standard Input in the following format:
A B C D
Output
Print the length of the duration (in seconds) in which both Alice and Bob were holding down their buttons.
Examples
Input
0 75 25 100
Output
50
Input
0 33 66 99
Output
0
Input
10 90 20 80
Output
60
inputFormat
input values are integers.
Input
Input is given from Standard Input in the following format:
A B C D
outputFormat
Output
Print the length of the duration (in seconds) in which both Alice and Bob were holding down their buttons.
Examples
Input
0 75 25 100
Output
50
Input
0 33 66 99
Output
0
Input
10 90 20 80
Output
60
样例
10 90 20 80
60