package main import "fmt" func main() { var L, R, M int fmt.Scan(&L, &R, &M) if R-L+1 >= M { fmt.Println(M) } else { fmt.Println(R - L + 1) } }