A, B, C, D = list(map(int, input().split()))



Alice = set([])

Bob = set([])



for i in range(A, B + 1):

  Alice.add(i)

for i in range(C, D + 1):

  Bob.add(i)



ans = Alice & Bob

ans = list(ans)

if len(ans) == 0:

  print((0))

  exit()

print((ans[-1] - ans[0]))
A, B, C, D = list(map(int, input().split()))





ans = min(D, B) - max(A, C)

print((max(ans, 0)))
A, B, C, D = list(map(int, input().split()))
Alice = set([])
Bob = set([])
for i in range(A, B + 1):
    Alice.add(i)
for i in range(C, D + 1):
    Bob.add(i)
ans = Alice & Bob
ans = list(ans)
if len(ans) == 0:
    print((0))
    exit()
print((ans[-1] - ans[0]))

A, B, C, D = list(map(int, input().split()))
ans = min(D, B) - max(A, C)
print((max(ans, 0)))

-Alice = set([]) -Bob = set([]) -for i in range(A, B + 1): -    Alice.add(i) -for i in range(C, D + 1): -    Bob.add(i) -ans = Alice & Bob -ans = list(ans) -if len(ans) == 0: -    print((0)) -    exit() -print((ans[-1] - ans[0])) +ans = min(D, B) - max(A, C) +print((max(ans, 0)))