N=int(input()) A,B=[],[] for _ in range(N-1): a,b=map(int, input().split()) A.append(a) B.append(b) SA,SB=sum(A),sum(B) m=min(SA,SB) print(m+1)