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

maxa = max(a)
mina = min(a)

print(maxa - mina)

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

A = [int(x) for x in input().split()]

max = A[0]
min = A[0]

for i in range(n):
    if A[i] > max:
        max = A[i]
    elif A[i] < min:
        min = A[i]


print(max-min)

Solution (Python):

import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, A: "List[int]"):
    print(max(A) - min(A))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = [int(next(tokens)) for _ in range(N)]  
    solve(N, 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()))

ans = max(A) - min(A)
print(ans)

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

print(abs(max(a_lst) - min(a_lst)))

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

max = 0

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

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

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

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

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

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

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=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()))
a.sort()
print(a[-1]-a[0])

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

Solution (Python):
import sys

IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))

INIT_VAL = 0
DP2 = lambda d1, d2: [[INIT_VAL]*d2 for _ in range(d1)]
DP3 = lambda d1, d2, d3: [[[INIT_VAL]*d3 for _ in range(d2)] for _ in range(d1)]

DIVC = lambda x, y: -(-x//y)
DIVF = lambda x, y: x//y

def main():
    n = II()
    aa = MII()
    aa.sort()
    print(aa[-1]-aa[0])

if __name__ == '__main__':
    main()

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

Solution (Python):
from sys import stdin

N = int(stdin.readline().rstrip())
A = list(map(int, stdin.readline().rstrip().split()))

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

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

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

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

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

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

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

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

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

MAX=max(a)
MIN=min(a)
print(MAX-MIN)

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

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

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

ans = -10000000000

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

print(ans)

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

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

Solution (Python):

import sys



def main():
    N = int(input())
    a = sorted(list(map(int,input().split())))
    print(a[-1] - a[0])
    return

if __name__ == '__main__':
    main()

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

Solution (Python):
N = int(input())
s = input().split()
p = [int(w) for w in s]

print(max(p) - min(p))

Solution (Python):
N = int(input())
l = [int(x) for x in input().split()]
m = []
for i in l:
  for j in l:
    ans = abs(i - j)
    m.append(ans)
    
print(max(m))

Solution (Python):

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

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

Solution (Python):
icase=0
if icase==0:
    n=input()
    a=list(map(int,input().split()))
    amax=max(a)
    amin=min(a)
    print(amax-amin)

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

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

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

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

Solution (Python):
input()
a = list(map(int,input().split()))
min = pow(10,9)
max =  1
for i in a:
    if i<min:
        min = i
    if i>max:
        max = i
print(max-min)

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

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

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

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

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

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

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

Solution (Python):

import io

data=int(input())
array=list(map(int,input().split()))
highest=max(array)
lowest=min(array)
print(highest-lowest)

Solution (Python):
N=int(input())
A=[int(i) for i in input().split()]
T=[]
for t in range(N-1):
    for s in range(t,N):
        T.append(abs(A[t]-A[s]))
print(max(T))

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

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

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

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

Solution (Python):
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n = ni()
a = nl()

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

Solution (Python):

n = int(input())
a = [int(s) for s in input().split()]
a.sort()
print(a[-1] - a[0])

Solution (Python):
N = int(input())
A = input()
Ai = A.split()

y = 0

for i in Ai:
  i = int(i)
  for I in Ai[1:N+1]:
    I = int(I)
    x = abs(I-i)
    if x > y:
      y = x
      
print(y)

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

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

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

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

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

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

print(max(A_list)-min(A_list))

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

max = 0
for i in range(n):
  if i > 0:
    for j in range(i):
        max1 = abs(a[i] - a[j])
        if max1 > max:
            max = max1

print(max)

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

A.sort()
A.reverse()
ans = A[0] - A[len(A)-1]

print(ans)

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

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

a = min(li)
b = max(li)

print(b-a)

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

Solution (Python):
n = 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(abs(a[0] - a[n-1]))

Solution (Python):
n=int(input())
Min=1000000001
Max=0
t=list(map(int,input().split()))
i=0
while i<n:
    if(t[i]>Max):
        Max=t[i]
    if(t[i]<Min):
        Min=t[i]
    i=i+1
print(Max-Min)

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

A = sorted(A)

ans = A[N-1] - A[0]

print(ans)

Solution (Python):
N,*A = map(int,open(0).read().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()))
x=[]
for i in range(n-1):
    for j in range(i+1,n):
        x.append(abs(a[i]-a[j]))
print(max(x))

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

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

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

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):
a=int(input())
b = input().split()
a_list =[]
for i in range(a):
    a_list.append(int(b[i]))
print(max(a_list)-min(a_list))

Solution (Python):
import math
n = int(input())
li = [int(x) for x in input().split()]
print(max(li) - min(li))

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


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

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

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

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

print(max(li))

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

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

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

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

max = 0
for i in range(n):
  for j in range(i):
    m = abs(list[j] - list[i])
    if (max < m):
      max = m
      
print(max)

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

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

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

max = 0

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

print(max)

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

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

min_A = min(A)
max_A = max(A)

print(max_A-min_A)

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

lis = []
for i in range(len(A)):
  for j in range(len(A)):
    lis.append(abs(A[i]-A[j]))

print(max(lis))

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

if '__main__' == __name__:
    resolve()

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

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

Solution (Python):
def q2():
    N = int(input())
    A = [int(i) for i in input().split()]
    Amax = max(A)
    Amin = min(A)
    print(Amax - Amin)


if __name__ == '__main__':
    q2()

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

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

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

Solution (Python):
N = int(input())
Alist = list(map(int,input().split()))
tmp = 0
ans = 0

for i in range(N):
  for j in range(N):
    if Alist[i] != Alist[j]:
      tmp = abs(Alist[i] - Alist[j])
    else:
      pass

    if tmp > ans:
      ans = tmp
    else:
      pass

print(ans)

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

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

Solution (Python):
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


if __name__ == '__main__':
    s = int(input())
    a = [int(i) for i in input().split()] 
    
    a.sort()
    print(abs(a[0] - a[len(a)-1]))

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

Solution (Python):










"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  _ = int(input())
  A = list(map(int,input().split()))
  
  A = sorted(A,reverse=True)
  print(abs(A[0] - A[_-1]))
  
if __name__ == '__main__':
  main()

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

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

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

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

num_ans = 0

for i in range(N):
  for j in range(N):
      tmp = abs(A[i] - A[j])
      if tmp > num_ans:
        num_ans = tmp

print(num_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):
N = int(input())
Alist = list(map(int,input().split()))
p =[]
for i in range(N):
    for j in range(N):
        p.append(abs(Alist[i]-Alist[j]))
print(max(p))

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


def main():
    A.sort()
    ans = A[-1] - A[0]
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
print(max(a) - min(a))

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
ans = -inf
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())
a = list(map(int, input().split()))

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

print(res)

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()))
ans = 0
for i in range(n):
    for j in range(n):
        ans = max(ans, abs(list_A[i]-list_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())
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()
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):
def Maximum(n , al):

    return max(al) - min(al)

def main():
    n = int(input())
    al = list(map(int , input().split()))
    print(Maximum(n , al))

if __name__ == '__main__':
    main()

Solution (Python):
def Maximum(n , al):

    return abs(max(al) - min(al))

def main():
    n = int(input())
    al = list(map(int , input().split()))
    print(Maximum(n , al))

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

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):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
A = sorted(iil())
print(A[-1]-A[0])

Solution (Python):


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate
    
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    

    
    

    N = int(input())
    a = list(map(int, input().split()))
    res = 0
    for i in combinations(a, 2):
        res = max(res, abs(i[0]-i[1]))
    print(res)

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

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

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

Solution (Python):
import math

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

print( max(s) - min(s))

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

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

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

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

L = list(map(int,input().split()))
L.sort()

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

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

Solution (Python):


def solve():
    _ = int(input())
    As = list(map(int, input().split()))
    print(max(As)-min(As))



if __name__ == "__main__":
    solve()

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

Solution (Python):

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

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

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

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

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

num_list.sort()

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

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

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

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

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

L.sort()

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

Solution (Python):
input()
min = 10**9
max = 0
list = list(map(int,input().split()))
for i in list:
    if min > i:
        min = i
    if max < i:
        max = i
print(max - min)

Solution (Python):
def main():
    n = int(input())
    As = sorted(list(map(int, input().split())))

    a = As[0]
    b = As[-1]

    ans = b - a
    print(ans)


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

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

N = int(input())
A = list(map(int, input().split()))
ans = list()
for i in itertools.combinations(A, 2):
  div = 0
  
  if i[0] > i[1]:
    div = i[0] - i[1]
  else:
    div = i[1] - i[0]
  ans.append(div)

print(max(ans))

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

Solution (Python):
import sys

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

num.sort()

print(num[-1] - num[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()))
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 = map(int, open(0).read().split())
print(max(a)-min(a))

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

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

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

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

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

Solution (Python):
import itertools
n=int(input())
a=list(map(int,input().split()))
m=0
for v in itertools.combinations(a,2):
    m=max(abs(v[0]-v[1]),m) 
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()))
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
import math
readline = sys.stdin.readline
n = int(readline())
a = sorted([int(x) for x in readline().strip().split(" ")])
print(int(math.fabs(a[-1] - a[0])))

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

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

Solution (Python):


import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

N = ni()
a = na()

ans = -inf
for i in range(N):
    for j in range(N):
        if i != j:
            ans = max(ans, abs(a[i] - a[j]))

print(ans)

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

Solution (Python):
n=int(input())
a_list = list(map(int,input().split()))
a_max = 0
a_min = 10000000000

for a in a_list:
    if a > a_max:
        a_max = a
    if a < a_min:
        a_min = a

print(a_max - a_min)

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

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

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

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

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

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

Solution (Python):
def main():
  input()
  ary = list(map(int, input().split()))
  minv = maxv = ary[0]
  for v in ary:
    if v < minv:
      minv = v
    elif v > maxv:
      maxv = v
  print(str(maxv - minv))
    
if __name__ == '__main__':
  main()

Solution (Python):
n = int(input())
li = list(map(int, input().split()))
ans = 0
for i in li:
    for j in li:
        ztc = abs(i - j)
        if ztc > ans:
            ans = ztc
print(ans)

Solution (Python):

s=[[int(j) for j in input().split()] for i in range(2)]
N=s[0][0]
A=s[1]
max=0
for i in range(len(A)):
    for j in range(i,len(A)-1):
        result=A[i]-A[j+1]
        if result<0:result=result*-1
        if result>max:max=result
print(max)

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

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

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

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

Solution (Python):
from itertools import permutations


def main(n, a):
    ans = 0
    for i, j in permutations(a, 2):
        ans = max(ans, i - j)

    print(ans)


if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))

    main(n, a)

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

Solution (Python):








def resolve():
    n=int(input())
    A=list(map(int,input().split()))

    print(max([abs(A[i]-A[j]) for i in range(n) for j in range(n)]))

resolve()

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

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

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
maximum = a[0]
minimum = a[0]
for i in range(1,n):
    maximum = max(maximum, a[i])
    minimum = min(minimum, a[i])

print(maximum-minimum)