import numpy as np

a, b, c, d = list(map(int, input().split()))



print((np.clip(min(b, d) - max(a, c), 0, None)))

a, b, c, d = list(map(int, input().split()))



time = min(b, d) - max(a, c)

if time >= 0:

  print(time)

else:

  print("0")

import numpy as np

a, b, c, d = list(map(int, input().split()))
print((np.clip(min(b, d) - max(a, c), 0, None)))

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

-import numpy as np - -print((np.clip(min(b, d) - max(a, c), 0, None))) +time = min(b, d) - max(a, c) +if time >= 0: +    print(time) +else: +    print("0")