A,B,C,D=map(int,input().split()) red=list(range(A,B+1)) blue=list(range(C,D+1)) common=len(set(red)&set(blue)) print(len(red)*len(blue)-common)