#include using namespace std; int main() { int a,b,c,d; cin>>a>>b>>c>>d; int overlap=0; for(int i=a;i<=b;i++){ if(c<=i && i<=d)overlap++; if(i>d)break; } //cout<