import sys readline=sys.stdin.readline A,B,C,D=map(int,readline().split()) ans=0 for i in range(A,B+1): for j in range(C,D+1): if i!=j: ans+=1 print(ans)