import sys

n = int(input())
r0 = int(input())
r1 = int(input())

mx = r1-r0
mn = min(r1,r0)
l = map(int,sys.stdin.readlines())
for i in l:
    if mx < i - mn:
        mx = i - mn
    elif mn > i:
        mn = i

print(mx) import sys sys n = int(input()) n int(input()) int input() input r0 = int(input()) r0 int(input()) int input() input r1 = int(input()) r1 int(input()) int input() input mx = r1-r0 mx r1-r0 r1 r0 mn = min(r1,r0) mn min(r1,r0) min r1 r0 l = map(int,sys.stdin.readlines()) l map(int,sys.stdin.readlines()) map int sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines for i in l:
    if mx < i - mn:
        mx = i - mn
    elif mn > i:
        mn = i i l if mx < i - mn:
        mx = i - mn
    elif mn > i:
        mn = i mx < i - mn mx i - mn i mn mx = i - mn mx i - mn i mn elif mn > i:
        mn = i mn > i mn i mn = i mn i print(mx) print mx r1 = int(input()) int(input()) r1 mx = i - mn i - mn mx mx = r1-r0 r1-r0 mx r0 = int(input()) int(input()) r0 mn = min(r1,r0) min(r1,r0) mn n = int(input()) int(input()) n l = map(int,sys.stdin.readlines()) map(int,sys.stdin.readlines()) l mn = i i mn
import sys

n = int(input())
r0 = int(input())
r1 = int(input())

mx = r1-r0
mn = min(r1,r0)
l = map(int,sys.stdin.readlines())
for i in l:
    if mx < i - mn:
        mx = i - mn
    elif mn > i:
        mn = i

print(mx)