a, b, c, d = map(int, input().split()) ans = (b - a + 1) * (d - c + 1) for i in range(a, b + 1): if c <= i <= d: ans -= 1 print(ans)