#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(min(b,d)-max(a,c)>0)cout<<min(b,d)-max(a,c);
	else cout<<0;
	return 0;
}

### Prompt

Your task is to create a CPP solution to the following problem:

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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(min(b,d)-max(a,c)>0)cout<<min(b,d)-max(a,c);
	else cout<<0;
	return 0;
}

```