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