from itertools import product a, b, c, d = map(int, input().split()) print(len([[i, j] for i,j in product(range(a, b+1), range(c, d+1)) if i != j]))