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

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

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

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

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

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

Solution (Python):
import itertools

X,*list1=open(0).read().split()

X=int(X)

list1=[int(i) for i in list1]



list2=list(itertools.combinations(list1,2))



aaa=[]

for i in list2:
    if i[0]>i[1]:
        aaa.append(i[0]-i[1])
    else:
        aaa.append(i[1]-i[0])



print(max(aaa))

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

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

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

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

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

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

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

Solution (Python):
from itertools import combinations
N = int(input())
A = [int(i) for i in input().split()]
a = list(combinations(A,2))
l =[]
for i in range(len(a)):
  l.append(abs(a[i][0] - a[i][1]))

print(max(l))

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

min_a=float("inf")
max_a=0
for aa in a:
  max_a=max(max_a,aa)
  min_a=min(min_a,aa)
print(max_a-min_a)

Solution (Python):
n = int(input())
a = [abs(i) for i in 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()))

ans = 0
tmp = 0
for i in range(len(a)):
    for j in range(i, len(a)):
        tmp = abs(a[i] - a[j])
        if tmp >= ans:
            ans = tmp
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(x) for x in input().split()]

min_value = -10000000
for i in range(n):
  for j in range(i+1, n):
    min_value = max(min_value, abs(l[i] - l[j]))
print(min_value)

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

arrays = []

max_num = 0

v = input().split()
for i in range(n):
    arrays.append(int(v[i]))

for i in range(len(arrays)):
    max_num = max(max_num, arrays[i])

min_num = max_num

for i in range(len(arrays)):
    min_num = min(min_num,arrays[i])

answer = max_num - min_num

print(answer)

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

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

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

print(max-min)

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()))
x = []
for i in range(n):
  for j in range(i+1,n):
    if i == n and j == n:
      pass
    else:
      x.append(abs(a[i]-a[j]))
print(max(x))

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

Solution (Python):
n = int(input())
numList = input().split()
minNum = numList[0]
maxNum = numList[n-1]

for i in range(len(numList)):
    if int(minNum) > int(numList[i]):
        minNum = numList[i]
    elif int(maxNum) < int(numList[i]):
        maxNum = numList[i]

print(int(maxNum) - int(minNum))

Solution (Python):
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  

N = I()
A = LI()
print(max(A)-min(A))

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    A = LI()

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

if __name__ == '__main__':
    resolve()

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

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

mx_a = 1
mn_a = 10**9
for i in range(N):
    if a[i] > mx_a:
        mx_a = a[i]
    if a[i] < mn_a:
        mn_a = a[i]
print(mx_a-mn_a)

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):
N =int(input())
a = list(map(int, input().split()))

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

Solution (Python):















































def calculation(lines):
    N = int(lines[0])
    values = [value for value in map(int, lines[1].split(' '))]
    max_diff = 0
    for i in range(len(values)):
        for j in range(len(values)):
            diff = abs(values[i] - values[j])
            if max_diff < diff:
                max_diff = diff
    return [max_diff]



def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines



def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['4', '1 4 6 3']
        lines_export = [5]
    if pattern == 2:
        lines_input = ['2', '1000000000 1']
        lines_export = [999999999]
    if pattern == 3:
        lines_input = ['5', '1 1 1 1 1']
        lines_export = [0]
    return lines_input, lines_export



def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode



def main():
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    
    
    
    
    
    
    
    



if __name__ == '__main__':
    main()

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

Solution (Python):

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

A.sort()
min = A[0]
max = A[-1]
X = max-min

print(X)

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

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

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

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

print(abs(max(an)-min(an)))

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())
List = list(map(int, input().split()))
mid = 0
res = 0
for i in range(N):
  for j in range(i+1,N):
    mid = abs(List[i]-List[j])
    res = max(res,mid)
print(res)

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

Solution (Python):
if __name__ == '__main__':

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

Solution (Python):
input()
a=sorted(list(map(int,input().split())))
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()))

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 = raw_input()
ais = map(int, raw_input().split())
print max(ais) - min(ais)

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

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

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

Solution (Python):
import numpy as np

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

arr = np.array(lists)
maximum = arr.max()
minimum = arr.min()
print(maximum - minimum)

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

n = int(input())
a_l = list(map(int, input().split()))
index_l = [i for i in range(len(a_l))]




max_ans = 0
for v in itertools.combinations(index_l, 2):


    ans = abs(a_l[v[0]] - a_l[v[1]])
    
    max_ans = max(max_ans, ans)
    
print(max_ans)

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

Solution (Python):
def main():
    n=int(input())
    a=sorted(map(int,input().split()))
    print(a[n-1]-a[0])
    
if __name__ == "__main__":
    main()

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

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

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):
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()
    num_list = i_list()

    max_num = 0
    for i in range(n-1):
        for j in range(i+1,n):
            max_num = max(max_num, abs(num_list[i]-num_list[j]))

    print(max_num)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = list(input().split())
a.sort(key=int)
print(int(a[-1]) - int(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()))

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

print(out)

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(" ")))
mmax = max(a)
mmin = min(a)
print(int(mmax - mmin))

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

Solution (Python):
N = int(input())
A = sorted(list(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()))

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

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

Solution (Python):
import math
def main():
  n = int(input())
  a=list(map(int,input().split()))
  max=a[0]
  min=a[0]
  
  for i in range(1,n):
    if a[i]>max:
      max=a[i]
    if a[i] < min:
      min=a[i]
  print(max-min)
main()

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

a_lst.sort()

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

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

print(abs(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())
numbers = list(map(int, input().split()))

result = 0

for a in numbers:
  for b in numbers:
    if abs(a-b)> result:
      result = abs(a-b)
    
print(result)

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

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

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):
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    print(max(A) - min(A))


if __name__ == "__main__":
    solve()

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

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())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
  for j in range(i+1,n,1):
    ans=max(ans,abs(a[i]-a[j]))
print(ans)

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

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

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

Solution (Python):
import sys
N = int(input())
array_A = list(map(int,input().split()))

if not (2 <= N <= 100):
    sys.exit()
for I in range(len(array_A)):
    if not (1 <= array_A[I] <= 10 ** 9):
        sys.exit()

print(max(array_A) - min(array_A))

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

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

Solution (Python):

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

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

Solution (Python):


N = int(input())
A = list(int(a) for a in 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):
N=int(input())
A=[int(x) for x in input().split()]
print(max(A)-min(A))

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

Solution (Python):
n = int(input())
a = sorted(list(map(int,input().split())))
print(a[n - 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[len(A)-1]- A[0])

Solution (Python):
n,*a=map(int,open(0).read().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=[int(i) for i in input().split()]


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

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

if len(set(l)) == 1:
  print(0)
else:
  print(max(l) - min(l))

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

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

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

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

print(abs(max(an)-min(an)))

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

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

for i in range(n) :
    for j in range(n):
        x = a[i]-a[j]
        while d < x:
            d = x

print (d)

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

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

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

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

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

B = sorted(A)

print(max(B)-min(B))

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 = sorted(a)
print(max(a1)-min(a1))

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

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

mina = min(lista)
maxa = max(lista)

ans = abs(maxa-mina)
print(ans)

Solution (Python):
def actual(N, A):
    return abs(max(A) - min(A))

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

print(actual(N, A))

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)
mod = 10**9+7

N = i()
A = l()
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())
lis = list(map(int, input().split()))

lis = sorted(lis)

print(abs(lis[0] - lis[n-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()))
ABS = []
for i in range(n-1):
    for j in range(i+1, n):
        ABS.append(abs(A[i] - A[j]))
print(max(ABS))

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

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

Solution (Python):

import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left 
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

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

Solution (Python):
_n = int(input())
lists = list(map(int, input().split()))
lists.sort()

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

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

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

Solution (Python):
import sys
from itertools import combinations
def input(): return sys.stdin.readline().strip()


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

if __name__ == "__main__":
    main()

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

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

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

print(max(alist)-min(alist))

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

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

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

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

Solution (Python):
def MI():
    return map(int, input().split())

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

N = int(input())
A = LI()
A.sort()

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

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

Solution (Python):
n, a = int(input()), list(map(int, input().split()))
s = []
for i in range(n):
  for p in range(n):
    s.append(a[i] - a[p])
print(max(s))

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

maximum_difference = max(list) - min(list)

print(maximum_difference)

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

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

Max=0
Min=10**9

for i in range(n):
    if(Max<a[i]):
        Max=a[i]
    if(Min>a[i]):
        Min=a[i]

print(abs(Max-Min))

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

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

print(max(alist)-min(alist))

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,a[i]-a[j],a[j]-a[i])
print(ans)

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

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

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

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

max=0
for i in range(n):
    for j in range(n):
        if i!=j:
            x=int(a[i]-a[j])
            y=abs(x)
            if max<=y:
                y
                max=y


print(max)

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

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

max=0
for i in range(n):
    for j in range(n):
        if i!=j:
            x=int(a[i]-a[j])
            if x<0:
                x *=-1
                if max<=x:
                    max=x


print(max)

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

m=[]
for i in range(n):
    for j in range(n):
        if i!=j:
            m.append(abs(l[i]-l[j]))
            
print(max(m))

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

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

A.sort()

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

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

l = max(s)
m = min(s)
print(l-m)

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):
N=int(input())
A=list(map(int,input().split()))
max=0

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

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

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

mx=abs(a[0]-a[1])
for i in range(n):
    for j in range(i+1,n):
        mx=max(mx,abs(a[i]-a[j]))

print(mx)

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

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

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

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

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

maxs = max(b)
mins = min(b)

print(maxs-mins)

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

Solution (Python):
N = int(input())
ans = 0
A=list(map(int,input().split()))
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 = sorted(map(int, input().split()))
print(A[-1]-A[0])

Solution (Python):
n = int(input())
A =list(map(int, input().split()))
s = 0
for i in range(n):
    for j in range(n):
        t = abs(A[i]-A[j])
        if s <= t:
            s = t
print(s)

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

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

Solution (Python):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    n = int(input())
    a_list = list(map(int, input().split()))

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

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

ma = max(a)

mi = min(a)


print(abs(mi-ma))

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

ANS = []
for i in range(len(A)):
  for j in range(i,len(A)):
    ANS.append(abs(A[i] - A[j]))
    
print(max(ANS))

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

    min = None
    max = None

    for a in A:
        if min is None or min > a:
            min = a
        if max is None or max < a:
            max = a

    print(max - min)


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()))
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())
a = list(map(int, input().split()))
s = set()
for i in range(n):
  for j in range(n):
    if i != j:
      s.add(abs(a[i] - a[j]))
print(max(list(s)))

Solution (Python):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

Solution (Python):
from itertools import combinations


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

if len(A) == 1:
    print(0)
else:
    nc2 = combinations(A, 2)

    max_sub = max(
        [
            max(a - b, b - a)
            for a, b in nc2
        ]
    )

    print(max_sub)

Solution (Python):
N = int(input())
*A, = 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())
a=list(map(int,input().split()))
dif=[]
for i in range(n-1):
  mx=0
  for j in range(i+1,n):
    md=abs(a[j]-a[i])
    if mx<md:
      mx=md
  dif.append(mx)
print(max(dif))

Solution (Python):
n = int(input())
a = tuple(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 = [int(i) for i in input().split()]

A = sorted(A)

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

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

A = sorted(A)

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

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