
n = int(input())

R = []

for i in range(n):
    R.append(int(input()))

kouho = set()
diff_max = None

for (i, rt) in enumerate(R):
    if i == 0:
        rt_min = rt
    else:
        if rt < rt_min and not (diff_max is None):
            kouho.add(diff_max)
            diff_max = None
            rt_min = rt
        elif rt < rt_min and diff_max is None:
            rt_min = rt
        elif rt >= rt_min:
            if diff_max is None:
                diff_max = rt - rt_min
            else:
                diff_max = max(diff_max, rt - rt_min)

if not (diff_max is None):
    kouho.add(diff_max)

# print(kouho)

if kouho != set():
    print(max(kouho))
else:
    diff_tonari = {R[i + 1] - R[i] for i in range(n - 1)}
    print(max(diff_tonari)) n = int(input()) n int(input()) int input() input R = [] R [] for i in range(n):
    R.append(int(input())) i range(n) range n R.append(int(input())) R.append R append int(input()) int input() input kouho = set() kouho set() set diff_max = None diff_max None for (i, rt) in enumerate(R):
    if i == 0:
        rt_min = rt
    else:
        if rt < rt_min and not (diff_max is None):
            kouho.add(diff_max)
            diff_max = None
            rt_min = rt
        elif rt < rt_min and diff_max is None:
            rt_min = rt
        elif rt >= rt_min:
            if diff_max is None:
                diff_max = rt - rt_min
            else:
                diff_max = max(diff_max, rt - rt_min) (i, rt) i rt enumerate(R) enumerate R if i == 0:
        rt_min = rt
    else:
        if rt < rt_min and not (diff_max is None):
            kouho.add(diff_max)
            diff_max = None
            rt_min = rt
        elif rt < rt_min and diff_max is None:
            rt_min = rt
        elif rt >= rt_min:
            if diff_max is None:
                diff_max = rt - rt_min
            else:
                diff_max = max(diff_max, rt - rt_min) i == 0 i 0 rt_min = rt rt_min rt if rt < rt_min and not (diff_max is None):
            kouho.add(diff_max)
            diff_max = None
            rt_min = rt
        elif rt < rt_min and diff_max is None:
            rt_min = rt
        elif rt >= rt_min:
            if diff_max is None:
                diff_max = rt - rt_min
            else:
                diff_max = max(diff_max, rt - rt_min) rt < rt_min and not (diff_max is None) rt < rt_min rt rt_min not (diff_max is None) diff_max is None diff_max None kouho.add(diff_max) kouho.add kouho add diff_max diff_max = None diff_max None rt_min = rt rt_min rt elif rt < rt_min and diff_max is None:
            rt_min = rt
         rt < rt_min and diff_max is None rt < rt_min rt rt_min diff_max is None diff_max None rt_min = rt rt_min rt elif rt >= rt_min:
            if diff_max is None:
                diff_max = rt - rt_min
            else:
                diff_max = max(diff_max, rt - rt_min) rt >= rt_min rt rt_min if diff_max is None:
                diff_max = rt - rt_min
            else:
                diff_max = max(diff_max, rt - rt_min) diff_max is None diff_max None diff_max = rt - rt_min diff_max rt - rt_min rt rt_min diff_max = max(diff_max, rt - rt_min) diff_max max(diff_max, rt - rt_min) max diff_max rt - rt_min rt rt_min if not (diff_max is None):
    kouho.add(diff_max)

# print(kouho) not (diff_max is None) diff_max is None diff_max None kouho.add(diff_max) kouho.add kouho add diff_max if kouho != set():
    print(max(kouho))
else:
    diff_tonari = {R[i + 1] - R[i] for i in range(n - 1)}
    print(max(diff_tonari)) kouho != set() kouho set() set print(max(kouho)) print max(kouho) max kouho R[i + 1] - R[i] for i in range(n - 1) for i in range(n - 1) i range(n - 1) range n - 1 n 1 for i in range(n - 1) R[i + 1] - R[i] R[i + 1] R i + 1 i 1 R[i] R i diff_tonari = {R[i + 1] - R[i] for i in range(n - 1)} diff_tonari print(max(diff_tonari)) print max(diff_tonari) max diff_tonari rt_min = rt rt rt_min n = int(input()) int(input()) n rt_min = rt rt rt_min rt_min = rt rt rt_min kouho = set() set() kouho diff_max = rt - rt_min rt - rt_min diff_max R = [] [] R diff_max = None None diff_max diff_max = max(diff_max, rt - rt_min) max(diff_max, rt - rt_min) diff_max diff_tonari = {R[i + 1] - R[i] for i in range(n - 1)} diff_tonari diff_max = None None diff_max

n = int(input())

R = []

for i in range(n):
    R.append(int(input()))

kouho = set()
diff_max = None

for (i, rt) in enumerate(R):
    if i == 0:
        rt_min = rt
    else:
        if rt < rt_min and not (diff_max is None):
            kouho.add(diff_max)
            diff_max = None
            rt_min = rt
        elif rt < rt_min and diff_max is None:
            rt_min = rt
        elif rt >= rt_min:
            if diff_max is None:
                diff_max = rt - rt_min
            else:
                diff_max = max(diff_max, rt - rt_min)

if not (diff_max is None):
    kouho.add(diff_max)

# print(kouho)

if kouho != set():
    print(max(kouho))
else:
    diff_tonari = {R[i + 1] - R[i] for i in range(n - 1)}
    print(max(diff_tonari))