a,b,c,d = list(map(int,input().split())) e = 0 for i in range(a,b+1): for j in range(c,d+1): if i!=j: e+=1 print(e)