#include using namespace std; using ll = long long; int main() { int cnt = 0; int a, b, c, d; cin >> a >> b >> c >> d; for(int i = a; i <= b; i++) { for(int j = c; j <= d; j++) { if(i == j)continue; cnt++; } } cout << cnt << endl; }