n = int(input())
p = [int(input()) for i in range(n)]

max_diff = -float('inf')
min_n = p[0]

for i in range(1, n):
  max_diff = max(max_diff, p[i] - min_n)
  min_n = min(min_n, p[i])

print(max_diff) n = int(input()) n int(input()) int input() input int(input()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(input()) int input() input p = [int(input()) for i in range(n)] p [int(input()) for i in range(n)] max_diff = -float('inf') max_diff -float('inf') float('inf') float 'inf' min_n = p[0] min_n p[0] p 0 for i in range(1, n):
  max_diff = max(max_diff, p[i] - min_n)
  min_n = min(min_n, p[i]) i range(1, n) range 1 n max_diff = max(max_diff, p[i] - min_n) max_diff max(max_diff, p[i] - min_n) max max_diff p[i] - min_n p[i] p i min_n min_n = min(min_n, p[i]) min_n min(min_n, p[i]) min min_n p[i] p i print(max_diff) print max_diff max_diff = -float('inf') -float('inf') max_diff min_n = p[0] p[0] min_n max_diff = max(max_diff, p[i] - min_n) max(max_diff, p[i] - min_n) max_diff p = [int(input()) for i in range(n)] [int(input()) for i in range(n)] p min_n = min(min_n, p[i]) min(min_n, p[i]) min_n n = int(input()) int(input()) n
n = int(input())
p = [int(input()) for i in range(n)]

max_diff = -float('inf')
min_n = p[0]

for i in range(1, n):
  max_diff = max(max_diff, p[i] - min_n)
  min_n = min(min_n, p[i])

print(max_diff)