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

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

x = len(set(range(a, b + 1)) & set(range(c, d + 1))) - 1

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

a, b, c, d = list(map(int, input().split()))
x = len(set(range(a, b + 1)) & set(range(c, d + 1))) - 1
print((x if x >= 0 else 0))

-print((max(0, (min(b, d) - max(a, c))))) +x = len(set(range(a, b + 1)) & set(range(c, d + 1))) - 1 +print((x if x >= 0 else 0))