# ABC102B - Maximum Difference

n = int(eval(input()))

lst = list(map(int, input().rstrip().split()))

max_dif = 0



for i in range(n):

    for j in range(n):

        max_dif = max(max_dif, abs(lst[i] - lst[j]))

    

print(max_dif)
# ABC102B - Maximum Difference

# Better ver.

n = int(eval(input()))

lst = sorted(list(map(int, input().rstrip().split())))

print((lst[-1] - lst[0]))
# ABC102B - Maximum Difference
n = int(eval(input()))
lst = list(map(int, input().rstrip().split()))
max_dif = 0
for i in range(n):
    for j in range(n):
        max_dif = max(max_dif, abs(lst[i] - lst[j]))
print(max_dif)

# ABC102B - Maximum Difference
# Better ver.
n = int(eval(input()))
lst = sorted(list(map(int, input().rstrip().split())))
print((lst[-1] - lst[0]))

+# Better ver. -lst = list(map(int, input().rstrip().split())) -max_dif = 0 -for i in range(n): -    for j in range(n): -        max_dif = max(max_dif, abs(lst[i] - lst[j])) -print(max_dif) +lst = sorted(list(map(int, input().rstrip().split()))) +print((lst[-1] - lst[0]))