ans = 0 A, B, C, D = map(int, input().split()) for r in range(A, B + 1): for b in range(C, D + 1): if r == b: continue ans += 1 print(ans)