#include int main(void){ int A,B,C,D; scanf("%d%d%d%d",&A,&B,&C,&D); int n=0; if(A<=C&&C<=B){ if(D<=B)n=D-C+1; if(B<=D)n=B-C+1;} else if(C<=A&&A<=D){ if(B<=D)n=B-A+1; if(D<=B)n=D-A+1;} printf("%d\n",(B-A+1)*(D-C+1)-n); return 0; }