N=int(input()) A,B=0,0 for i in range(N-1): x,y=map(int, input().split()) A+=x B+=y print(B+1)