def f(i,ans,l):
  if (i+1) == (len(l)-1):
    return max(ans,l[i+1]-l[i])
  else:
    return f(i+1,max(ans,l[i+1]-l[i]),l)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
print(str(f(0,0,ani)))