A, B, C, D = map(int,input().split()) ans = (B-A+1)*(D-C+1) m = min(A, B, C, D) M = max(A, B, C, D) kabri = 0 for i in range(m,M+1): if A <= i and i <= B and C <= i and i <= D: kabri += 1 print(ans-kabri)