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):
import math
import string


def readints():
    return list(map(int, input().split()))


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


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


n = int(input())
a = list(map(int, input().split()))
ans = 0
ansans = 0
for i in range(n):
    for j in range(n):
        ans = abs(a[i]-a[j])
        ansans = max(ansans, ans)
print(ansans)

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

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

ans = abs(n[0] - n[l-1])
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()))

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())
a = list(map(int,input().split()))
print(max(a)-min(a))

Solution (Python):
from itertools import combinations

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

print(max(abs(a - b) for a, b in combinations(A, 2)))

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-1):
        temp=abs(a[i]-a[j])
        ans=max(ans,temp)
print(ans)

Solution (Python):
N=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):
c = int(input())
s = list(map(int, input().split()))
print(max(s) - min(s))

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

Solution (Python):


n = int(input())
a = sorted(list(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()))
maxi = 0
mini = float("inf")
for n in A:
  maxi = max(maxi,n)
  mini = min(mini,n)
print(maxi-mini)

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

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

max_dif = 0
for i in range(N):
  for j in range(N):
    dif = A[i] - A[j]
    if dif > max_dif:
      max_dif = dif
      
print(max_dif)

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

for i in range(n):
    if a[i] < 0:
        a[i] *= -1

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()))
a.sort()
print(a[n-1]-a[0])

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()))
ans=0
for i in range(n):
    for j in range(n):
        ans=max(ans,abs(A[i]-A[j]))
print(ans)

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

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

for i in range(n):
    for j in range(n):
        ans = max(abs(a[i] - a[j]), ans)
print(ans)

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

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

t.sort()

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

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

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(int(max(A)) - int(min(A)))

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

a.sort()

print(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()))

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

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

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

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

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

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

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

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

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()))
ans = 0
for i in range(N-1):
  for j in range(i,N):
    ans = max( ans, abs(A[i]-A[j]))
print(ans)

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

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

Solution (Python):
from collections import deque

N = int(input())
a = list(map(int, input().split()))
a.sort()
a = deque(a)
print(a.pop() - a.popleft())

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

A_list.sort()

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

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    a=LIST()
    print(max(a)-min(a))
if __name__ == '__main__':
    do()

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

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

print(Max-Min)

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

min_a = min(a)
max_a = max(a)
print(abs(min_a - max_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=list(map(int,input().split()))
print(sorted(A_list)[-1]-sorted(A_list)[0])

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

M = max(a)
m = min(a)

d = M-m

if d < 0:
  d = -d
else:
  pass

print(d)

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

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

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

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
A.sort()
print(A[len(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())
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())
a = list(map(int, input().split())) 
m = []
for i in range(N):
    for j in range(N):
        m.append(abs(a[i]-a[j]))
        
print(max(m))

Solution (Python):

N=int(input())
A=list(map(int,input().split()))
M=0
m=float('inf')
for i in range(N):
      M=max(M,A[i])
      m=min(m,A[i])
print(M-m)

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):
        diff = abs(A[i] - A[j])
        ans = max(ans, diff)
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()))
a1 = max(a)
a2 = min(a)
print(a1-a2)

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

Solution (Python):

N=int(input())
A=[int(n) for n in input().split()]
Ans=0
for i in range(N):
    for j in range(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):


n = int(input().strip())
nums = list(map(int, input().rstrip().split()))

calc=[]
for i in range(len(nums)-1):
    for j in range(i+1,len(nums)):
        calc += [ abs(nums[i] - nums[j]) ]

print(max(calc))

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()))
l=[]
def abs(x):
    if x >=0:
        return x
    else:
        return x*(-1)
for j in range(N):
    for k in range(j+1,N):
        l.append(abs(A[k]-A[j]))
max=l[0]
for m in range(len(l)):
    if max<l[m]:
        max=l[m]
print(max)

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

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

Solution (Python):
N = int(input())
list_A = [int(x) for x in input().split()]

print(max(list_A) - min(list_A))

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

def main():
    n = input()
    vals = list(map(int, input().split()))
    print(max(vals) - min(vals))


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
dist = []
for i in range(n):
    for j in range(n):
        if i >= j:
            continue
        dist.append(abs(a[i]-a[j]))
print(max(dist))

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

for i in range(N):
  for j in range(i, N):
    if Max < abs(a[i]-a[j]):
      Max = abs(a[i]-a[j])

print(Max)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
L = []
for i in range(N-1):
    for j in range(i+1, N):
        l = A[i] - A[j]
        abs_l = abs(l)
        L.append(abs_l)

print(max(L))

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(abs(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(i+1, n):
        ans = max(ans, abs(a[i] - a[j]))
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
dist = []
for i in range(n):
    for j in range(n):
        if i >= j:
            continue
        dist.append(abs(a[i]-a[j]))
print(max(dist))

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()))
A.sort()
print(A[-1] - A[0])

Solution (Python):
from itertools import combinations

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

arr = []
for v in combinations(a,2):
    arr.append(abs(v[0]-v[1]))

print(max(arr))

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

Solution (Python):




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


if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
N = int(input())
lst = [int(n) for n in input().split(" ")]
val_max = lst[0]
val_min = lst[0]
for i in lst:
  if val_max < i:
    val_max = i
  elif val_min > i:
    val_min = i
  
print(val_max-val_min)

Solution (Python):
N = int(input())
lst = [int(n) for n in input().split(" ")]
   
print(max(lst)-min(lst))

Solution (Python):
def main():
    list_length = int(input())
    num_list = list(map(int, input().split(" ")))
    answer = -float("inf")
    for i in range(list_length):
        for j in range(i, list_length):
            answer = max(answer, abs(num_list[i] - num_list[j]))
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
try:
  N = int(input())
  a = list(map(int, input().split()))
  a_ = sorted(a)
  print(a_[len(a_)-1]-a_[0])
  
except EOFError:
  pass

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())
list=list(map(int, input().split()))
list.sort()
print(list[-1]-list[0])

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

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

infinity = float('inf')
min = infinity
max = -1

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

print(max - min)

Solution (Python):


import sys


def solve(cells):
    answer = 0
    cells.sort(reverse=True)
    answer = cells[0] - cells[-1]
    return answer


if __name__ == "__main__":
    X = list(map(int, sys.stdin.readline().split()))
    AI = list(map(int, sys.stdin.readline().split()))
    print(solve(AI))

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

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,b = max(A), min(A)
if abs(a-b) > (b-a):
    print(abs(a-b))
else:
    print(abs(b-a))

Solution (Python):


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

x = 0
for i in range(0,n-1):
    for j in range(i,n):
        x = max(abs(l[i] - l[j]), x)
print(x)

Solution (Python):


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

x = 0
for i in range(0,n-1):
    for j in range(i,n):
        
        x = max(abs(l[i] - l[j]), x)
print(x)

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())
numbers = [int(i) for i in input().split()]

max_num = max(numbers)
min_num = min(numbers)

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 = int(input())
raw = list(map(int, input().split(' ')))

MAX = max(raw)
MIN = min(raw)

ans = abs(MAX - MIN)
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()))
Ans=[]
for i in range(N):
    for k in range(N):
        t=A[k]-A[i]
        t2=abs(t)
        Ans.append(t2)
print(max(Ans))

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

maxi = A[0]
mini = A[0]
for i in range(N):
    if maxi < A[i]:
        maxi = A[i]
    if mini > A[i]:
        mini = A[i]
print(maxi-mini)

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

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

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

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

ans=max(a_l)-min(a_l)
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()))
a.sort()
print(a[-1]-a[0])

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

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

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

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

Solution (Python):


import sys


def solver(allN, numberList):
    answer = 0
    for j in range(0, allN):
        for k in range(0, allN):
            nowAbs = (numberList[j] - numberList[k]).__abs__()
            if answer < nowAbs:
                answer = nowAbs
    return answer


if __name__ == "__main__":
    N = sys.stdin.readline().rsplit()
    Ai = list(map(int, sys.stdin.readline().split()))
    answer = solver(int(N[0]), Ai)
    print(answer)

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

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

a.sort()

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

Solution (Python):
n , *A = map(int,open(0).read().split()) 
print(max(A)-min(A))

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 = [int(i) for i in input().split()]

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

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):
        a = abs(A[i]-A[j])
        ans = max(ans,a)
print(ans)

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

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

Solution (Python):
N = int(input())
A = input().split()
A = [int(i) for i in A]
s = sorted(A)
print(s[-1]-s[0])

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

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

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

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

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

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

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

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

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()))
A.sort()
print(A[N-1]-A[0])

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

aa = sorted(a)
ans = aa[n-1]-aa[0]
print(ans)

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

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):
        if abs(a[i]- a[j]) > ans:
            ans = abs(a[i]- a[j])
print(ans)

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):

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline().split()[0])
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())
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 = input()
list1 = list(map(int, input().split()))
print(max(list1)-min(list1))

Solution (Python):


import sys


def solve(N, givenList):
    answer = 0
    sortedList = sorted(givenList, reverse=True)
    answer = sortedList[0]-sortedList[-1]
    return answer


if __name__ == "__main__":
    N = int(sys.stdin.readline())
    Ai = list(map(int, sys.stdin.readline().split(' ')))
    print(solve(N, Ai))

Solution (Python):
N = input()
A = list(map(int, input().split()))
top = 0
bottom = 10 ** 9
for a in A:
    if a > top:
        top = a
    if a < bottom:
        bottom = a
print(abs(top - bottom))

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

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

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

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

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

Solution (Python):
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys




read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, *A = map(int, read().split())
A.sort()
print(A[-1]-A[0])

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


Diff = []
for i in range(N):
    stv = A[i]
    for i in range(N):
        x = stv - A[i]

        Diff.append(abs(x))
    
print(max(Diff))

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
diff = [0]*(n**2 - n)
count = -1

for i in range(n):
  for ii in range(n-i-1):
    count = count + 1
    diff[count] = abs(a[i] - a[i+ii+1])
print(max(diff))

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

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

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

Solution (Python):
n = input()

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

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

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

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

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

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

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()))

ans = max(A) - min(A)

print(ans)

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

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

print(maxA-minA)

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
minimum=a[0]
max=a[0]

for i in range(N):
  if a[i]<minimum:
    minimum=a[i]
  if a[i]>max:
    max=a[i]

print(max-minimum)

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

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

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

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
li.sort()
print(abs(li[-1]-li[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()))
D = []
A.sort()
min_A = A[0]
A.sort(reverse=True)
max_A = A[0]
print(max_A - min_A)

Solution (Python):
_ = int(input())
nums = list(map(int, input().split()))
max_n = 0
min_n = 100000000000000000000000
for i in nums:
	if max_n < i:
		max_n = i
	if min_n > i:
		min_n =i
print(max_n - min_n)

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

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

Solution (Python):
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


N = int(sys.stdin.buffer.readline())
A = list(map(int, sys.stdin.buffer.readline().split()))
A.sort()
print(A[-1] - A[0
])

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

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

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

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

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

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()))

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

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

sorted_A = sorted(A)


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

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

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

a.sort(reverse=True)

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

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

a.sort(reverse=True)

ans = 0
for i in range(n):
	for j in range(i+1, n):
		if a[i] - a[j] > ans:
			ans = a[i] - a[j]

print(ans)

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())
a = [int(x) for x 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())
A = list(map(int, input().split()))
A.sort()
print(abs(A[0] - A[-1]))

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

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







print(max(As) - min(As))

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

m = -1
for i in range(N-1):
    for j in range(i+1, N):
        m = max(abs(As[i] - As[j]), m)
print(m)

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

Solution (Python):



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

ans = 0
for i in range(1,N):
    for j in range(i):
        if ans < abs(A[i]-A[j]):
            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 = input()
l = list(map(int,input().split()))

l.sort()

print(l[-1] - l[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()))














print(max(L) - min(L))

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

diff = 0
maxNum = 0
maxDiffArray = []
for i in range(len(L)):
    diffArray = []
    for j in range(len(L)):
        if i != j:
            diff = abs(L[i] - L[j])
            diffArray.append(diff)
    maxDiffArray.append(max(diffArray))
print(max(maxDiffArray))

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())
array = list(map(int, input().split()))
array.sort()
ans = array[N-1]-array[0]
print(ans)

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

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

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

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

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

new = sorted(li)

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

Solution (Python):


N = int(input())
As = list(map(int, input().split()))
As.sort()

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

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

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

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
li = [int(i) for i in input().split()]
li.sort()
print(li[-1] - li[0])

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

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

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

Solution (Python):
import math
import fractions
import heapq
import sys
import re
from collections import Counter
import datetime
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN




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

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

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

max = 0

for i in range(N):
    for j in range(i+1,N):
        temp = abs(A[i]-A[j])
        if max < temp:
            max = temp
print(max)

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

max_ = -1
for i in range(n):
    for j in range(i+1, n):
        tmp = abs(lst[i] - lst[j])
        if tmp > max_:
            max_ = tmp
print(max_)

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

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

Solution (Python):

 
import math
import itertools
import sys
import copy
 



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

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

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


if __name__ == '__main__':
    main()

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

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

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

A.sort()
ans = abs(A[-1] - A[0])
print(ans)

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

a.sort(reverse=True)
print(abs(a[n-1]-a[0]))