import sys
input()
a,b=-1e11,1e11
for i in map(int,sys.stdin.readlines()):
  a=max(a,i-b)
  b=min(i,b)
print(a) import sys sys input() input a,b=-1e11,1e11 a -1e11 b 1e11 for i in map(int,sys.stdin.readlines()):
  a=max(a,i-b)
  b=min(i,b) i map(int,sys.stdin.readlines()) map int sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines a=max(a,i-b) a max(a,i-b) max a i-b i b b=min(i,b) b min(i,b) min i b print(a) print a b=-1e11,1e11 1e11 b a=max(a,i-b) max(a,i-b) a b=min(i,b) min(i,b) b a,b=-1e11,1e11 -1e11 a
import sys
input()
a,b=-1e11,1e11
for i in map(int,sys.stdin.readlines()):
  a=max(a,i-b)
  b=min(i,b)
print(a)