a,b,c,d=list(map(int,input().split())) if b>d: a,c=c,a b,d=d,b ans = (b-a+1)*(d-c+1) if a<=c and c<=b: ans-= b-c+1 print(ans)