A, B, C, D = input().strip().split(' ') A, B, C, D = int(A), int(B), int(C), int(D) cnt = 0 for i in range(A, B + 1): for j in range(C, D + 1): if i != j: cnt += 1 print(cnt)