A, B, C, D = map(int,input().split()) if B < C or D < A: print((B-A+1)*(D-C+1)) elif C <= B and B <= D: print((B-A+1)*(D-C+1)-(B-C+1)) elif C <= B and D <= B: print((B-A+1)*(D-C+1)-(D-C+1)) elif C <= A and A <= D: print((B-A+1)*(D-C+1)-(D-A+1)) elif C <= A and B <= D: print((B-A+1)*(D-C+1)-(B-A+1))