open System open System.Collections.Generic [] module Cin = let read f = stdin.ReadLine() |> f let reada f = stdin.ReadLine().Split() |> Array.map f let readInts() = read string |> Seq.toArray |> Array.map (fun x -> Convert.ToInt32(x.ToString())) module Util = let strRev s = s |> Seq.rev |> Seq.map string |> String.concat "" [] let main _ = let N = read int let AB = Array.zeroCreate (N - 1) for i in 0 .. N - 2 do AB.[i] <- reada int let asum = AB |> Array.sumBy (fun ab -> ab.[0]) let bsum = AB |> Array.sumBy (fun ab -> ab.[1]) let diff = asum - bsum let lim = asum let ans = lim - diff + 1 printfn "%d" ans 0 // return an integer exit code