a, b, c, d = map(int, input().split())
c = min(b, d) - max(a, c)
if c > 0:
    print(c)
else:
    print(0)

7e60f28ae139c7e5e51bbc071a9b754ca025b669
<mask token>

<mask token>
if c > 0:
    print(c)
else:
    print(0)

a, b, c, d = map(int, input().split())
c = min(b, d) - max(a, c)
if c > 0:
    print(c)
else:
    print(0)
