# test = '1 1 1 1' a, b, c, d = map(int, input().split()) # a, b, c, d = map(int, test.split()) x = b - a + 1 y = d - c + 1 dup = 0 if b < c: dup = 0 elif c < a: dup = 0 else: if a <= c and c < b: # print('a') dup = b - c + 1 elif a <= c and b <= d: # print('b') dup = d - a + 1 elif c <= b and b < d: # print('c') dup = b - c + 1 elif c <= a and b <= d: # print('d') dup = d - c + 1 print(x * y - dup)