# 全探索 ans = 0 A, B, C, D = map(int, input().split()) for red in range(A,B+1): for black in range(C,D+1): if red != black: ans += 1 print(ans)