import strutils, sequtils, math

proc main() =
  let
    abm = stdin.readLine.strip.split.map(parseBiggestInt)
    (a, b, m) = (abm[0], abm[1], abm[2])

  echo min(m, b - a + 1)
main()