N = int(eval(input()))

num_lists = list(map(int, input().split()))

max_num = max(num_lists)

min_num = min(num_lists)

ans = max_num - min_num

print(ans)
N = int(eval(input()))

num_lists = list(map(int, input().split()))

ans = 0

 

for i in num_lists:

  for j in num_lists:

    diff = abs(i - j)

    if diff > ans:

      ans = diff

print(ans)
N = int(eval(input()))
num_lists = list(map(int, input().split()))
max_num = max(num_lists)
min_num = min(num_lists)
ans = max_num - min_num
print(ans)

N = int(eval(input()))
num_lists = list(map(int, input().split()))
ans = 0
for i in num_lists:
    for j in num_lists:
        diff = abs(i - j)
        if diff > ans:
            ans = diff
print(ans)

-max_num = max(num_lists) -min_num = min(num_lists) -ans = max_num - min_num +ans = 0 +for i in num_lists: +    for j in num_lists: +        diff = abs(i - j) +        if diff > ans: +            ans = diff