package main import "fmt" func main(){ var a,b,c,d int fmt.Scan(&a, &b, &c, &d) ans := 0 for i := a; i <= b; i++ { if (c <= i) && (i <= d){ ans += d-c }else{ ans += d-c+1 } } fmt.Println(ans) }