"""
Rule: Pluck an equal amount of apple from each tree
      Once start plucking any of tree every consecutive tree until last tree.
input1=N, number of trees
input2=An array of N element a1 a2 a3 .....an

output :
         An integer output denoting Maximum Number of ripe apples

Example 1:  
         input1 = 3
         input2 = [80 48 82]

         output 144         48+48+48=144

Example 2:
         input1 = 3
         input2 = [8 40 77]

         output    80         40+40=80


"""
def maxApple(arr):
    for i in range(len(arr)):
        



        


N=int(input())
arr=list(map(int,input().split()))
print(maxApple(arr))















