a, b, c, d = [int(x) for x in input().split()] ans = 0 for i in range(a, b + 1): for j in range(c, d + 1): if i != j: ans += 1 print(ans)