class Problem0799: def solve(this): a,b,c,d = list(map(int, input().split())) res = 0 for i in range(a,b+1): for j in range(c,d+1): if i != j: res += 1 print(res) if __name__ == "__main__": problem = Problem0799() problem.solve()