import System.IO
import Data.List

type CookieCount = Int
type YuckCount = CookieCount
type YummyCount = CookieCount
type PoisonedCount = CookieCount

eatableCount' :: YuckCount -> YummyCount -> PoisonedCount -> CookieCount
eatableCount' yuck yummy poisoned = min (yuck + yummy) (poisoned + 1)

main = do
  args <- getLine
  let [yuck, yummy, poisoned] = map read $ words args :: [Int] 
  putStr . show $ eatableCount' yuck yummy poisoned