countPoints :: [Int] -> Int countPoints (x : y : d : _) = max 0 $ d + 1 - max 0 (d - y) - max 0 (d - x) main :: IO () main = print . countPoints . map read . words =<< getLine