let [|x; y; d|] = stdin.ReadLine().Split " " |> Array.map int if d > x + y then 0 elif d < min x y then d + 1 elif d > x + y - min x y then x + y - d + 1 else min x y + 1 |> printfn "%d"