a, b, c, d = map(int, input().split()) l1 = [i for i in range(a, b+1)] l2 = [i for i in range(c, d+1)] l3 = [] for i in l1: for j in l2: if i != j: l3.append([i ,j]) print(len(l3))