A, B, C, D = map(int, input().split()) X = max(0, min(B, D) - max(A, C) + 1) print(X * (D - C) + (B - A - X + 1) * (D - C + 1))