Problem:
 Score : 200 points    Problem Statement You are given an integer sequence A of length N .
Find the maximum absolute difference of two elements (with different indices) in A .      Constraints  2 \leq N \leq 100  1 \leq A_i \leq 10^9  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  A_1  A_2  ...  A_N       Output Print the maximum absolute difference of two elements (with different indices) in A .        Sample Input 1 4
1 4 6 3      Sample Output 1 5  The maximum absolute difference of two elements is A_3-A_1=6-1=5 .       Sample Input 2 2
1000000000 1      Sample Output 2 999999999       Sample Input 3 5
1 1 1 1 1      Sample Output 3 0

Solution (Python):
n=int(input())
a=[int(_) for _ in input().split()]
ans = 0
for i in range(1,n):
    for j in range(i):
        ans = max(ans,abs(a[i]-a[j]))
print(ans)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
print(max(A)-min(A))

Solution (Python):
n = int(input())
l = [int(_) for _ in input().split()]
ans = 0
for i in range(n):
    for j in range(n):
        tem = abs(l[i] - l[j])
        if ans < tem:
            ans = tem
print(ans)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]

print(max(a)-min(a))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
print(max(a)-min(a))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
print(max(a) - min(a))

Solution (Python):
n = int(input())
s = list(map(int, input().split()))
min_num = min(s)
max_num = max(s)
print(max_num-min_num)

Solution (Python):
input()
a=list(map(int,input().split()))
print(max(a)-min(a))

Solution (Python):
input()
x=list(map(int,input().split()))
print(max(x)-min(x))

Solution (Python):
N=int(input())
A=list(map(int,input().split()))

A.sort()
print(A[-1]-A[0])

Solution (Python):
N = int(input())
S = input().split()
S_i = [int(s) for s in S]
tmp_result = 0

for num_i in S_i:    
    for num_ii in S_i:
        difference = abs(num_i - num_ii)
        if difference > tmp_result:
            tmp_result = difference
    
print(tmp_result)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

mx = A[0]
mn = A[0]

for i in range(N):
    if A[i] > mx: mx = A[i]
    if A[i] < mn: mn = A[i]

print(mx - mn)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A.sort()

print(A[N - 1] - A[0])

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
print(max(a) - min(a))

Solution (Python):
N=input()
a_sorted=sorted( list(map(int,input().split())) )
print(a_sorted[-1]-a_sorted[0])

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    print(max(a) - min(a))


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))

print(max(a) - min(a))

Solution (Python):
n = input()
a = list(map(int,input().split()))
print(max(a)-min(a))

Solution (Python):
n=input()
m= map(int, input().split())
array =[int(i) for i in m]
max=max(array)
min=min(array)
print(max-min)

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    a.sort()
    print(abs(a[0] - a[-1]))


if __name__ == '__main__':
    slove()

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
print(max(A)-min(A))

Solution (Python):
import itertools

N = int(input())
A = list(map(int, input().split()))
ans = 0
for a, b in itertools.combinations(A, 2):
    ans = max(abs(a - b), ans)
print(ans)

Solution (Python):
N,*A = map(int,open(0).read().split())
A.sort()
print(abs(A[-1]-A[0]))

Solution (Python):
n = int(input())
L = list(map(int, input().split()))
L.sort()
print(L[-1]-L[0])

Solution (Python):
n =int(input())
a =[int(_) for _ in input().split()]
print(max(a)-min(a))

Solution (Python):
N = int(input())
A = sorted(map(int, input().split()))

print(abs(A[-1] - A[0]))

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
print(max(li)-min(li))

Solution (Python):
N = int(input())
m = 1e9
M = 0
a = list(map(int, input().split()))
for i in range(N):
  m = min(m, a[i])
  M = max(M, a[i])
print(M - m)

Solution (Python):
n=int(input())
a=list(map(int, input().split()))
print(max(a)-min(a))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
print(max(A) - min(A))

Solution (Python):
n=int(input())
li=list(map(int,input().split()))
li.sort()
print(li[n-1]-li[0])

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
M = A[0]
m = A[0]
for i in range(1,N):
  if A[i] > M:
    M = A[i]
  if A[i] < m:
    m = A[i]
print(int(M - m))

Solution (Python):
n=int(input())
li=list(map(int,input().split()))
li.sort()
print(int(li[n-1])-int(li[0]))

Solution (Python):
a = int(input())
l = list(map(int,input().split()))
m = l[0]
M = l[0]
for i in range(1,a):
  if l[i]<m:
    m = l[i]
  else:
    if l[i]>M:
      M = l[i]
    else:
      pass
print(M-m)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))

b=max(a)
c=min(a)

print(b-c)

Solution (Python):
input()
A = [int(x) for x in input().split()]
print(abs(max(A) - min(A)))

Solution (Python):
n = int(input())
s = input().split()
numbers = [int(i) for i in s]
maxDif = 0
for i in range(n):
  for j in range(i+1,n):
    maxDif = max(maxDif, abs(numbers[i] - numbers[j]))
    
print(maxDif)

Solution (Python):

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


a = min(list)
b = max(list)


print(b - a)

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
M = 0
for i in range(n):
        for j in range(i,n):
                a = abs(li[i] - li[j])
                if a > M:
                        M = a
print(M)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort()
print('{0}'.format(a[n-1]-a[0]))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
print(max(a)-min(a))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
M = a[0]
m = a[0]
for i in range(1, n):
  if a[i] > M:
    M = a[i]
  if a[i] < m:
    m = a[i]
print(int(M - m))

Solution (Python):
n=input()
a=list(map(int,input().split()))
print(max(a)-min(a))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
  for j in range(i + 1, N):
    ans = max(ans, abs(A[i] - A[j]))
print(ans)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
M = max(l)
m = min(l)
print(M-m)

Solution (Python):
a = int(input())
lis = list(map(int,input().split()))
print(max(lis)-min(lis))

Solution (Python):

N = input()

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

ans = max(A) - min(A)

print(ans)

Solution (Python):
input()
a = sorted(map(int, input().split()))
print(a[-1]-a[0])

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
print(max(A) - min(A))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
print(a[-1]-a[0])

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A = sorted(A)
print(A[-1]-A[0])

Solution (Python):

N = input()
A = sorted(map(int, input().split()))
print(A[-1] - A[0])

Solution (Python):
N = int(input())
A =[int(x) for x in input().split()]
ans =0
for i in range(N):
  for j in range(i+1,N):
    ans = max(ans,abs(A[i]-A[j]))
print(ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
print(max(a)-min(a))

Solution (Python):
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int,input().split()))

s = int(a[0])
t = int(a[0])

for i in a:
    if s < i:
        s = i
    if t > i:
        t = i
'''
for i in a:
    if t > i:
        t = i
'''

print(s - t)

Solution (Python):
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int,input().split()))

s = int(a[0])
t = int(a[0])

for i in a:
    if s < i:
        s = i

for i in a:
    if t > i:
        t = i

print(s - t)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
print(max(A)-min(A))

Solution (Python):
n = int(input())
l=list(map(int ,input().split()))
print(max(l)-min(l))

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()]

print(max(A)-min(A))

Solution (Python):
n=int(input())
l=[int(i) for i in input().split()]
print(int(((max(l)-min(l))**2)**0.5))

Solution (Python):
s=int(input())
a=list(map(int,input().split()))
print(max(a)-min(a))

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort()
print(a[-1]-a[0])

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

print(max(a)-min(a))

Solution (Python):
n = int(input())

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

print(abs(max(num) - min(num)))

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
print(max(A)-min(A))

Solution (Python):
n=input()
a=list(map(int,input().split()))
print(max(a)-min(a))

Solution (Python):
n = int(input())

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

print(max(a) - min(a))

Solution (Python):
n = int(input())
a = [ int(i) for i in input().split() ]
a2 = sorted(a)
print(a2[-1]-a2[0])

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
B = []
for i in range(1,N):
  B.append(A[0]-A[i])
print(max(abs(min(B)), abs(max(B)), abs(max(B)-min(B))))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
print(max(a) - min(a))

Solution (Python):

def main():
    N, *A = map(int, open(0).read().split())
    ans = max(A) - min(A)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
print(abs(max(A)-min(A)))

Solution (Python):
n = int(input())
a =[int(i) for i in input().split()]
a.sort()
print(a[-1]-a[0])

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
print(max(a)-min(a))

Solution (Python):
n=int(input())
L=list(map(int,input().split()))
a=max(L)
b=min(L)
print(a-b)

Solution (Python):
n = input()
args = input().split()
nums = [0]*len(args)

for i in range(len(args)):
    nums[i] = int(args[i])

print(max(nums) - min(nums))

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
print(max(A)-min(A))

Solution (Python):
n = int(input())
a = sorted(map(int, input().split()))
print(a[-1] - a[0])

Solution (Python):
n = int(input())

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

lis = []

for i in range(n - 1):
  for j in range(i + 1, n):
    lis.append(abs(a[i] - a[j]))
    
print(max(lis))

Solution (Python):
from itertools import combinations

N = int(input())
A = list(map(int, input().split()))

res = 0
for p, q in combinations(A,2):
    res = max(res, abs(p-q))
print(res)

Solution (Python):
N = int(input())

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

A_s = set(A)
A.sort()
A.reverse()

a1 = A[0]
a2 = A[-1]


print(a1-a2)

Solution (Python):

N = int(input())
A_list = list(map(int, input().split()))


M = max(A_list)
m = min(A_list)
result = M - m

print(result)

Solution (Python):

N = int(input())
A_list = list(map(int, input().split()))


M = max(A_list)
m = min(A_list)
result = M - m

print(result)

Solution (Python):
input()
a = sorted(map(int, input().split()))
print(a[-1] - a[0])

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
print(max(a) - min(a))

Solution (Python):
n = int(input())
array = list(map(int, input().split()))

ans = 0
for i in range(n):
    for j in range(n):
        if ans < abs(array[i] - array[j]):
            ans = abs(array[i] - array[j])

print(ans)

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = input()
a = list(map(int, input().split()))
print(max(a)-min(a))

Solution (Python):
n = int(input())
A = sorted(map(int,input().split()))
print(A[-1]-A[0])

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
print(max(A)-min(A))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
print(max(a)-min(a))

Solution (Python):
N=int(input())
l=sorted(list(map(int,input().split())))
print(l[-1]-l[0])

Solution (Python):
N=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(N-1):
  for j in range(i+1,N):
    ans=max(ans,abs(l[i]-l[j]))
print(ans)

Solution (Python):
n = int(input())
a = sorted(list(map(int,input().split())))
print(a[-1]-a[0])

Solution (Python):
n = int(input())
a = sorted(map(int,input().split()))
print(a[n-1]-a[0])

Solution (Python):
N = int(input())
A = [int(str) for str in input().strip().split()]

print(max(A) - min(A))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

print(max(A) - min(A))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

print(max(a)-min(a))

Solution (Python):
n = int(input())
A = sorted([int(num) for num in input().split()])
print(max(A) - min(A))

Solution (Python):
n = input()
a = list(map(int, input().split()))

a.sort()
print(abs(a[-1]-a[0]))

Solution (Python):
N = int(input())
An = list(map(int, input().split()))

print(max(An) - min(An))

Solution (Python):




def main():

    N = int(input())
    aList = list(map(int,input().split()))
    atMax = max(aList)
    atMin = min(aList)
    print(atMax-atMin)



 





if __name__ == "__main__":
    main()

Solution (Python):
_=input()
a=list(map(int,input().split()))

print(max(a)-min(a))

Solution (Python):
n = int(input())
ls = sorted(map(int, input().split()))
print(abs(ls[0] - ls[-1]))

Solution (Python):
N = int(input())
Nlist = input().split()

wMax = int(Nlist[0])
wMin = int(Nlist[0])
for value in Nlist:
    if int(value) > wMax:
        wMax = int(value)
    if int(value) < wMin:
        wMin = int(value)

print(abs(wMax - wMin))

Solution (Python):
n = int(input())
A = list(map(int,input().split()))
print(max(A)-min(A))

Solution (Python):
input()
nums = list(map(int, input().split()))

print(max(nums) - min(nums))

Solution (Python):
n = int(input())
src = list(map(int, input().split()))
print(max(src)-min(src))

Solution (Python):
n = int(input())
a =list(map(int, input().split()))
a.sort()
print(a[-1] - a[0])

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
cand = []
for i in range(n):
    for j in range(i + 1, n):
        cand.append(abs(a[i] - a[j]))
print(max(cand))

Solution (Python):
N=int(input())
A=input().split()
A=[int(A[i]) for i in range(0,N)]
max=A[0]
min=A[0]
for i in range(1,N):
    if max<A[i]:
        max=A[i]
    if min>A[i]:
        min=A[i]
dif=max-min
print(dif)

Solution (Python):
N=int(input())
A=input().split()
A=[int(A[i]) for i in range(0,N)]
max=A[0]
min=A[0]
for i in range(1,N):
    if max<A[i]:
        max=A[i]
    if min>A[i]:
        min=A[i]
dif=max-min
print(dif)

Solution (Python):
N=int(input())
A=input().split()
A=[int(A[i]) for i in range(0,N)]
max=A[0]
min=A[0]
for i in range(1,N):
    if max<A[i]:
        max=A[i]
    if min>A[i]:
        min=A[i]
dif=max-min
print(dif)

Solution (Python):
N = input()
A = list(map(int, input().split()))

print(max(A)-min(A))

Solution (Python):
N,*A=map(int,open(0).read().split())
A = sorted(A)
print(A[-1]-A[0])

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

maxA = max(A)
minA = min(A)

print(maxA - minA)

Solution (Python):
input()
a = sorted(map(int, input().split()))
print(abs(a[-1]-a[0]))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

print(max(A)-min(A))

Solution (Python):
m = int(input())
i = list(map(int,input().split()))

i_max = max(i)
i_min = min(i)

print(abs(max(i)-min(i)))

Solution (Python):
_ = input()
A = list(map(int, input().strip().split(' ')))
print(max(A)-min(A))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
print(max(a)-min(a))

Solution (Python):
input()
a = list(map(int, input().split()))
print(abs(max(a) - min(a)))

Solution (Python):
n = int(input())
maximum = 0
a = list(map(int,input().split()))
for i in range(n):
  for j in range(i+1,n):
    if abs(a[i]-a[j]) > maximum:
      maximum = abs(a[i]-a[j])
print(maximum)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a.sort()
print(a[-1]-a[0])

Solution (Python):
N = int(input())
A = list(map(int,input().split()))

A = sorted(A)

print(A[-1] - A[0])

Solution (Python):
n = int(input())
arr = list(map(int, input().split()))
print(max(arr) - min(arr))

Solution (Python):
N=input()
A = list(map(int,input().split()))
print(abs(max(A)-min(A)))

Solution (Python):
n=int(input())
box=list(map(int,input().split()))
print(max(box)-min(box))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
print(max(a) - min(a))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
diff = 0
for i in range(N):
    for j in range(i, N):
        diff_new = abs(A[i] - A[j])
        if diff_new > diff:
            diff = diff_new
            
print(diff)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

print(max(A) - min(A))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
M = 0
for i in range(N):
    for j in range(i + 1, N):
        if (max(A[i], A[j]) - min(A[i], A[j])) > M:
            M = (max(A[i], A[j]) - min(A[i], A[j]))
print(M)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
print(max(a)-min(a))

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
print(max(a)-min(a))

Solution (Python):
N = int(input())
A = list(map(int,input().split()))

A.sort()

print(abs(A[N-1]-A[0]))

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
print(max(a)-min(a))

Solution (Python):
import numpy as np

N = int(input())
As = input().split()
for i in range(N):
  As[i] = int(As[i])  
As = np.array(As)

max_val = np.max(As)
min_val = np.min(As)

print(max_val-min_val)

Solution (Python):
N=int(input())
a=sorted(map(int,input().split()))
print(a[-1]-a[0])

Solution (Python):
n = int(input())
arr = list(map(int, input().split(" ")))

min = 1000000000
max = 1


for i in arr:
  if min > i:
    min = i
  if max < i:
    max = i

ans = max - min
print(ans)

Solution (Python):
input()
A=(sorted(map(int,input().split())))
print(A[-1]-A[0])

Solution (Python):
A =int(input())
l =list(map(int,input().split()))
s =(sorted(l))
print(s[-1]-s[0])

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
print(max(a) - min(a))

Solution (Python):
input()
s = sorted(map(int,input().split()))
print(s[-1]-s[0])

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
print(max(A) - min(A))

Solution (Python):
n = int(input())
lst = sorted(map(int, input().split()))
print(lst[-1]-lst[0])

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

print(max(a) - min(a))

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A.sort()
print(A[-1]-A[0])

Solution (Python):
import sys
input=sys.stdin.readline

def main():
    _ = int(input())
    A = list(map(int, input().split()))
    A.sort()
    print(A[-1]-A[0])

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

print(max(A) - min(A))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
ans=0
for i in range(N):
  for j in range(N):
    if abs(A[i] - A[j]) > ans:
      ans = abs(A[i] - A[j])
print(ans)

Solution (Python):

N = int(input())
A = list(map(int,input().split()))

ans = 0
for i in range(N):
    for j in range(i+1,N):
        t = abs(A[i]-A[j])
        ans = max(ans,t)
print(ans)

Solution (Python):
N = int(input())
As = list(map(int, input().split()))
r = max(As)-min(As)
print(r)

Solution (Python):
input()
a = set(map(int,input().split()))
print(max(a)-min(a))

Solution (Python):
N = int(input())
A = [int(_) for _ in input().rstrip().split()]

ans = 0
for i in range(N):
    for j in range(N):
        temp = abs(A[i]-A[j])
        ans = max(ans, temp)

print(ans)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))

print(max(a)-min(a))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
maxabs = 0

for i in range(n):
  for j in range(i+1,n):
    c = abs(a[i] - a[j])
    maxabs = max(maxabs,c)
    
print(maxabs)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

print(max(a) - min(a))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

A = sorted(A)
print(A[-1]-A[0])

Solution (Python):
input()
A = list(map(int, input().split()))
print(max(A) - min(A))

Solution (Python):
def resolve():
    n = int(input())
    aaa = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        for j in range(i,n):
            ans = max(ans, abs(aaa[i]-aaa[j]))
    print(ans)
resolve()

Solution (Python):
import sys
from collections import deque
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
a_li = na()
ans = -1
for i in range(n):
    for j in range(i+1, n):
        ans = max(ans, abs(a_li[i] - a_li[j]))
print(ans)

Solution (Python):
_ = input()
a = sorted(list(map(int, input().split())))
print(abs(a[-1] - a[0]))

Solution (Python):
n=int(input())
a=sorted(map(int,input().split()))
print(a[-1]-a[0])

Solution (Python):
N = int(input())
As = list(map(int, input().split()))
max_diff = - float('inf')
for i in range(N):
    for j in range(i + 1, N):
        max_diff = max(max_diff, abs(As[i] - As[j]))
print(max_diff)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))

ans = 0

for i in a:
    for j in a:
        ans = max(ans,i-j)

print(ans)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))

deka = a[0]
mini = a[0]
for i in range(1,n):
  if a[i] > deka:
    deka = a[i]
  if a[i] < mini:
    mini = a[i]

print(abs(deka - mini))

Solution (Python):
N = int(input())

a = sorted(map(int,input().split()))

print(max(a)-min(a))

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort()

print(a[-1]-a[0])

Solution (Python):


input()
seq = list(map(int, input().split()))
print(max(seq) - min(seq))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
print(max(a) - min(a))

Solution (Python):
n = int(input())
a_list = list(map(int, input().split()))

max_zettai = 0
for i in range(n-1):
    for j in range(i+1, n):
        sa = abs(a_list[j] - a_list[i])
        max_zettai = max(sa, max_zettai)
print(max_zettai)

Solution (Python):
n = int(input())
an = list(map(int, input().split()))
print(max(an) - min(an))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
max = max(a)
min = min(a)
print(max-min)

Solution (Python):
input()
A=list(map(int,input().split()))
print(max(A)-min(A))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
mina = a[0]
maxa = a[0]
for i in range(n):
         if a[i] > maxa:
                  maxa = a[i]
         elif a[i] < mina:
                  mina = a[i]
print(maxa - mina)

Solution (Python):
n = int(input())
a = sorted(list(map(int, input().split())))

print(max(a) - min(a))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

print(max(a) - min(a))

Solution (Python):
n = int(input())
A = list(map(int,input().split()))
print(max(A)-min(A))

Solution (Python):
n,a=open(0);s=sorted(map(int,a.split()));print(s[-1]-s[0])

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
print(max(a)-min(a))

Solution (Python):
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

mod = 1000000007

"""


    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())


    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    L = list(map(int, sys.stdin.readline().split()))

    ans = 0
    for l1 in L:
        for l2 in L:
            diff = abs(l1- l2)
            ans = max(ans, diff)
    print(ans)

Solution (Python):
N = int(input())
A  = list(map(int,input().split()))
if max(A) == min(A):
    print(0)
else:
    print(max(A)-min(A))

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
a.sort()
print(abs(a[-1]-a[0]))

Solution (Python):
n=int(input())
a = list(map(int,input().split()))
ans=0
for i in range(n-1):
    for j in range(n-i-1):
        j+=i+1
        d=a[i]-a[j]
        if(d<0):
            d=-d
        ans=max(ans,d)

print(ans)

Solution (Python):
input()
n = list(map(int, input().split()))
print(max(n) - min(n))

Solution (Python):
N = int(input())
n = list(map(int, input().split()))
print(max(n) - min(n))

Solution (Python):
N = int(input())
n = list(map(int, input().split()))
print(0 if max(n) == min(n) else max(n) - min(n))

Solution (Python):
def test():
    n = int(input())
    a = list(map(int,input().split()))
    print(abs(max(a)-min(a)))


if __name__ == "__main__":
    test()

Solution (Python):
input()
r=list(map(int,input().split()))
print(max(r)-min(r))

Solution (Python):
_ = input()
a = list(map(int, input().split()))
print(max(a) - min(a))

Solution (Python):
n = int(input())
array = list(map(int,input().split()))
print(abs(max(array)-min(array)))

Solution (Python):
n = int(input())
array =  list(map(int,input().split()))
ma = 0

for i in range(n):
    for j in range(i+1,n):
      ma = max(ma,abs(array[i]-array[j]))
print(ma)

Solution (Python):
def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    A = sorted(A)
    return A[-1] - A[0]

if __name__ == '__main__':
    print(main())

Solution (Python):
n = int(input())
a = sorted(list(map(int,input().split())))
print(a[-1]-a[0])

Solution (Python):
input()
nl = [int(s) for s in input().split()]
print(max(nl) - min(nl))

Solution (Python):
import sys
from collections import deque
import copy

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    nums = string_to_int(inputs[0])
    nums.sort()
    return abs(nums[0] - nums[-1])


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)

Solution (Python):
n=int(input())
a=sorted(list(map(int,input().split())));print(a[-1]-a[0])

Solution (Python):
n = int(input())
a_list = list(map(int, input().split()))

print(int(max(a_list) - min(a_list)))

Solution (Python):
n = int(input())
a = sorted(list(map(int, input().split())))

print(abs(a[0]-a[-1]))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

print(abs(max(a)-min(a)))

Solution (Python):
_, N = input(), list(map(float, input().split()))

max = 0
min = 10 ** 9

for i in N:
    if max < i:
        max = i
    if min > i:
        min = i

print(int(abs(min - max)))

Solution (Python):
_, N = input(), list(map(float, input().split()))

print(int(abs(max(N) - min(N))))

Solution (Python):
c=int(input())
n=list(map(int, input().split()))
print(max(n) - min(n))

Solution (Python):
N = int(input())
n_list = sorted(list(map(int,input().split())))

print(abs(n_list[-1]-n_list[0]))

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
max_diff = 0
for i in range(n):
    for j in range(i+1,n):
        tmp = abs(a[i] - a[j])
        if max_diff < tmp:
            max_diff = tmp

print(max_diff)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A.sort()
print(A[len(A) - 1] - A[0])

Solution (Python):
input()
A = list(map(int,input().split()))

print(max(A)-min(A))

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
print(max(A)-min(A))

Solution (Python):
n=int(input())

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

print(max(a)-min(a))

Solution (Python):
N = int(input())
a = sorted(map(int, input().split()))
print(a[-1] - a[0])

Solution (Python):
n= int(input())
array = [int(i) for i in input().split()]

array.sort()

print(array[-1]-array[0])

Solution (Python):
n = int(input())
a = input().split()


for i in range(n):
	a[i] = int(a[i])

a = sorted(a)

print(int(a[len(a)-1] - a[0]))

Solution (Python):
n = input()
a = sorted(map(int,input().split()))
print(a[-1]-a[0])

Solution (Python):
n=int(input())
l=sorted(list(map(int,input().split())))
print(l[n-1]-l[0])

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
A.sort()
print(A[-1]-A[0])

Solution (Python):
def solve():
    n = int(input())
    a = list(map(int, input().split()))
    return max(a) - min(a)


if __name__ == "__main__":
    print(solve())

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
lst = []
for i in range(N-1):
    for j in range(i+1,N):
        lst.append(abs(a[i]-a[j]))
print(max(lst))

Solution (Python):
N = list(map(int, input().split()))
A = list(map(int, input().split()))
mx = max(A)
mn = min(A)
print(mx - mn)

Solution (Python):
N = int(input())
AN = [int(x) for x in input().split()]
print(max(AN)-min(AN))

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
print(max(a)-min(a))

Solution (Python):
n = int(input())

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

B = a.sort()


print(a[-1]-a[0])

Solution (Python):
input()
A = list(map(int,input().split()))
print(max(A) - min(A))

Solution (Python):
N = int(input())
l = list(map(int, input().split()))

print(max(l) - min(l))

Solution (Python):
input()
l=list(map(int,input().split()))
print(max(l)-min(l))

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
ans = -100
for i in range(N):
    for j in range(i, N):
        s = abs(A[i] - A[j])
        ans = max(ans, s)
print(ans)

Solution (Python):
N = input()
A=sorted(map(int,input().split()),reverse = True)
s = A[0]-A[-1]
print(s)

Solution (Python):
N = int(input())
As = list(map(int, input().split()))

ans = -1

for i in range(N):
  for j in range(i, N):
    tmp = abs(As[i] - As[j])
    ans = max(ans, tmp)
    
print(ans)

Solution (Python):
N = int(input())
x = sorted(map(int,input().split()))
print(abs(x[-1]-x[0]))

Solution (Python):
a=int(input())
b=sorted(map(int,input().split()))
print(b[-1]-b[0])

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    
    print(abs(max(A) - min(A)))

main()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

print(abs(max(A) - min(A)))

Solution (Python):
input()
A = list(map(int, input().split()))
print (max(A) - min(A))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
print(abs(a[0] - a[-1]))

Solution (Python):
n=int(input())
a1=input().split()
a2=[]
for i in range(n):
    a2.append(int(a1[i]))

print(max(a2)-min(a2))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a.sort()
print(a[-1] - a[0])

Solution (Python):
input()
a=sorted(map(int,input().split()))
print(a[-1]-a[0])

Solution (Python):
n=int(input())
a=list(map(int, input().split()))
print(max(a)-min(a))

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A.sort()
print(A[N - 1] - A[0])

Solution (Python):
n = int(input())
a = sorted(list(map(int,input().split())))
print(a[-1]-a[0])