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