Caisa solved the problem with the sugar and now he is on the way back to home. 

Caisa is playing a mobile game during his path. There are (n + 1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i (i > 0) has height h_{i}. The goal of the game is to reach n-th pylon, and the only move the player can do is to jump from the current pylon (let's denote its number as k) to the next one (its number will be k + 1). When the player have made such a move, its energy increases by h_{k} - h_{k} + 1 (if this value is negative the player loses energy). The player must have non-negative amount of energy at any moment of the time. 

Initially Caisa stand at 0 pylon and has 0 energy. The game provides a special opportunity: one can pay a single dollar and increase the height of anyone pylon by one. Caisa may use that opportunity several times, but he doesn't want to spend too much money. What is the minimal amount of money he must paid to reach the goal of the game?


-----Input-----

The first line contains integer n (1 ≤ n ≤ 10^5). The next line contains n integers h_1, h_2, ..., h_{n} (1  ≤  h_{i}  ≤  10^5) representing the heights of the pylons.


-----Output-----

Print a single number representing the minimum number of dollars paid by Caisa.


-----Examples-----
Input
5
3 4 3 2 4

Output
4

Input
3
4 4 4

Output
4



-----Note-----

In the first sample he can pay 4 dollars and increase the height of pylon with number 0 by 4 units. Then he can safely pass to the last pylon.

Difficulty: interview

Starter code:

Solutions:
"""
Codeforces Contest 264 Div 2 Problem B

Author  : chaotic_iak
Language: Python 3.3.4
"""

def main():
    n, = read()
    print(max(read()))

################################### NON-SOLUTION STUFF BELOW

def read(mode=2):
    # 0: String
    # 1: List of strings
    # 2: List of integers
    inputs = input().strip()
    if mode == 0: return inputs
    if mode == 1: return inputs.split()
    if mode == 2: return list(map(int, inputs.split()))

def write(s="\n"):
    if s is None: s = ""
    if isinstance(s, list): s = " ".join(map(str, s))
    s = str(s)
    print(s, end="")

write(main())

sa = int(input())
array = [0]+list(map(int, input().split(' ')))
array2 = [array[x]-array[x+1] for x in range(len(array)-1)]

maxx = 0
drop = pow(10, 19)
for element in array2:
    maxx += element
    if maxx < drop:
        drop = maxx
print(abs(drop))


import itertools
import math
import random

import time
def timer(f):
    def tmp(*args, **kwargs):
        t = time.time()
        res = f(*args, **kwargs)
        print("Время выполнения функции: %f" % (time.time()-t))
        return res

    return tmp

def genArray(length, lower, upper):
    return [random.randint(lower, upper) for i in range(length)]


n = int(input())
array = list(map(int, input().split(' ')))

print(max(array))

n = int(input()) + 1
a = [0] + list(map(int, input().split()))
ans = 0
power = 0
for i in range(n - 1):
    if a[i] < a[i + 1]:
        delta = a[i + 1]-a[i]
        dd = min(delta, power)
        delta -= dd
        power -= dd
        ans+=delta
    else:
        power+=a[i]-a[i+1]
print(ans)

n = int(input())
h = list(map(int, input().split()))
h = [0] + h
e = 0
res = 0
for i in range(1, n + 1):
    e += h[i - 1] - h[i]
    if e < 0:
        res += abs(e)
        e = 0
print(res)

n = int(input())
print(max(list(map(int, input().split()))))

input()
print(max(list(map(int, str.split(input())))))


n=int(input())
m=list(int(x) for x in input().split())
m=[0]+m
d=0
c=0
e=0
p=0
for i in range(0,n):
    t=m[i]-m[i+1]
    if (e+t)>0:
        e+=t
    else:
        c+=abs(e+t)
        e=0
    #print (t,e,c)
print(c)

#B
input()
e = 0
h = 0
r = 0
for x in [int(i) for i in input().split()]:
    t = x - h # столько энергии требуется
    if e < t:
        r = r + (t - e)
        e = 0
    else:
        e = e - t
    h = x
print(r)


def __starting_point():
    n = int(input())

    print(max(int(i) for i in input().split()))


__starting_point()

n = int(input())
hmax = 0
h = [int(i) for i in input(). split()]
for i in range(n):
    if h[i] > hmax:
        hmax = h[i]
print(hmax)



n = int(input())

heights = input()
splitted = heights.split(' ')
splitted.reverse()
splitted.append('0')
splitted.reverse()

energy = 0
dollars = 0

for i in range(0, len(splitted) - 1):
    h = int(splitted[i])
    hplus = int(splitted[i + 1])

    diff = hplus - h

    if diff > energy:
        dollars += (diff - energy)
        energy = 0
    else:
        energy -= diff

print(dollars)


#! /usr/bin/env python3

n = int(input())
numbers = [int(x) for x in input().split()]

m = 0

for n in numbers:
	if (n > m):
		m = n

print(m)




# -*- coding: utf-8 -*-
import sys

n = int(sys.stdin.readline().strip())
arr = [int(x) for x in sys.stdin.readline().strip().split()]
print(max(arr))


n = int(input())
a = list(map(int, input().split()))

ans = 0
power = 0
prev = 0
for i in range(n):
    if power + prev - a[i] < 0:
        dif = -(power + prev - a[i])
        prev += dif
        ans += dif
    power += prev - a[i]
    prev = a[i]
print(ans)


n=int(input())
L=list(map(int,input().split()))
e=0
p=0
ans=0
for i in range(n):
    diff=p-L[i]
    e+=diff
    if(e<=0):
        ans+=-e
        e=0
    p=L[i]
print(ans)


[n]=[int(x) for x in input().split()]
h=[int(x) for x in input().split()]
h=[0]+h
det=0
m=100000000000
for i in range(1,n+1):
	det=det+(h[i-1]-h[i])
	#print(det)
	m=min(m,det)
print(-m)


Count=input()
Maininpt=list(map(int,input().split()))
print(max(Maininpt))


n = int(input())
n1 = [int(x) for x in input().split(" ")]
print(max(n1))


n = int(input())
print(max(list(map(int, input().split()))))


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

x = input()
pylons = [0]
y = input()
y += ' '
vesl = ''
for letter in y:
    if letter == ' ':
        pylons.append(int(vesl))
        vesl = ''
    else:
        vesl += letter
energy = 0
money = 0
for i in range(len(pylons)-1):
    if pylons[i+1] > (pylons[i] + energy):
        money += pylons[i+1] - (pylons[i] + energy)
        energy = 0
    else:
        energy += pylons[i] - pylons[i+1]
print(money)

#use Python3

n = input("");
array = [ int(i) for i in input("").split(" ") ];

print((max(array)));


n = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
    if ans < x:
        ans = x

print(ans)

n=int(input())
print(max(list(map(int, input().split()))))