bzoj#P3841. ZCC Loves Intersection

ZCC Loves Intersection

题目描述

数轴上有两条闭线段 [a,b][a,b] 与 [c,d][c,d],求它们的交集长度(若不相交则为 00)。

输入格式

一行四个整数 a,b,c,da,b,c,d(0≤a≤b≤1090\le a\le b\le 10^9,0≤c≤d≤1090\le c\le d\le 10^9)。

输出格式

输出一行一个整数,表示交集长度。

样例输入

1 5 3 8

样例输出

2