#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c,d;cin >> a >> b >> c >> d;
	if(d<a || c>b){
		cout << (b-a+a)*(d-c+1) << endl;
	}
	else if(c<a && d>b){
		cout << (b-a+1)*(d-c+1)-(b-a+1) << endl;
	}
	else if(c<a && d>=a){
		cout << (b-a+1)*(d-c+1)-(d-a+1) << endl;
	}
	else if(c<=b && d>b){
		cout << (b-a+1)*(d-c+1)-(b-c+1) << endl;
	}
	else{
		cout << (b-a+1)*(d-c+1)-(d-c+1) << endl;
	}
}