a, b, c, d = map(int, input().split()) s = set(range(c, d+1)) cnt = 0 for i in range(a, b+1): if i in s: cnt += 1 print((b-a+1)*(d-c+1)-cnt)