n = int(raw_input())
R = []
R.append(int(raw_input()))
minv = R[0]
maxv = -1 * 10**9
for j in range(1,n):
    R.append(int(raw_input()))
    maxv = max(maxv,R[j]-minv)
    minv = min(minv,R[j])
print maxv n = int(raw_input()) n int(raw_input()) int raw_input() raw_input R = [] R [] R.append(int(raw_input())) R.append R append int(raw_input()) int raw_input() raw_input minv = R[0] minv R[0] R 0 maxv = -1 * 10**9 maxv -1 * 10**9 -1 10**9 10 9 for j in range(1,n):
    R.append(int(raw_input()))
    maxv = max(maxv,R[j]-minv)
    minv = min(minv,R[j]) j range(1,n) range 1 n R.append(int(raw_input())) R.append R append int(raw_input()) int raw_input() raw_input maxv = max(maxv,R[j]-minv) maxv max(maxv,R[j]-minv) max maxv R[j]-minv R[j] R j minv minv = min(minv,R[j]) minv min(minv,R[j]) min minv R[j] R j print n = int(raw_input()) int(raw_input()) n minv = min(minv,R[j]) min(minv,R[j]) minv maxv = max(maxv,R[j]-minv) max(maxv,R[j]-minv) maxv minv = R[0] R[0] minv R = [] [] R maxv = -1 * 10**9 -1 * 10**9 maxv
n = int(raw_input())
R = []
R.append(int(raw_input()))
minv = R[0]
maxv = -1 * 10**9
for j in range(1,n):
    R.append(int(raw_input()))
    maxv = max(maxv,R[j]-minv)
    minv = min(minv,R[j])
print maxv