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

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

Solution (Python):

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

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

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

Solution (Python):
import sys

n, *a = map(int, sys.stdin.read().split())

def main():
    a.sort()
    return a[-1] - a[0]

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

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

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

min_diff = 0
for i in itertools.product(A, repeat=2):
    min_diff = max(min_diff, abs(i[0]-i[1]))
print(min_diff)

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

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

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

ma,mi = 0,10**9

for i in lst1:
    ma = max(ma,i)
    mi = min(mi,i)

print(abs(ma-mi))

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

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

if __name__ == '__main__':
    main()

Solution (Python):
s=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 = [int(i) for i in input().split()]
max_ans = 0
for i in range(N):
    for j in range(N):
        ans = abs(A[i]-A[j])
        if(max_ans < ans):
            max_ans = ans

print(max_ans)

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

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

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

print(max(ls) - min(ls))

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

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

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

Solution (Python):


n=int(input())

A=[int(i) for i in input().split()]
ans=-1
for i in range(0,n-1):
    for k in range(i+1,n):
        ans=max(ans,abs(A[i]-A[k]))

print(ans)


"""
4
1 4 6 3

5

2
1000000000 1

999999999

5
1 1 1 1 1

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

Solution (Python):
N = int(input())
A = input()
A = A.split()
L = len(A)
B =[]
for i in range(L):
    B.append(int(A[i]))
B.sort(reverse=True)
ans = B[0] - B[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()))
max = 0
min = 10**10

for x in A:
    if x > max:
        max = x
    if x < min:
        min = x

print(max - min)

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]
temp = []
for i in range(0, N):
    for j in range(i, N):
        temp.append(abs(A[i]-A[j]))

print(max(temp))

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

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

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

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

Solution (Python):
import math

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

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

l = list(map(int, sys.stdin.readline().split()))

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

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

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

a_L = sorted(a_L)
print(abs(a_L[0]-a_L[-1]))

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

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

print(res)

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

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

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

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

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

Solution (Python):
import itertools as it

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

ans = 0


diff = 0

for x1,x2 in list(it.combinations(A,2)):
        if (diff < abs(x1 - x2)):
                diff = abs(x1 - x2)

print(diff)

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

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

print(max(ll)-min(ll))

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

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

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

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

Solution (Python):
from itertools import combinations

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

combs = combinations(A, 2)

ret = 0
for comb in combs:
    if abs(comb[0] - comb[1]) > ret:
        ret = abs(comb[0] - comb[1])

print(ret)

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

A_new = sorted(A)

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

Solution (Python):
n = int(input())
line = map(int,input().split(" "))
nums = list(line)
ma = max(nums)
mi = min(nums)
answer = ma - mi
print(answer)

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

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

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

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

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

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

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

Solution (Python):
x = int(input())
l = [int(i) for i in input().split()]
zet = 0

for i in l:
    for j in l:
        if abs(i - j) >= zet:
            zet = abs(i-j)

print(zet)

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):
input(); [print(max(list_) - min(list_)) for list_ in [list(map(int, input().split()))]]

Solution (Python):

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

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

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

Solution (Python):
_ = input()
lst = [int(i) for i in input().split()]

print(max(lst) - min(lst))

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

Solution (Python):

import sys, math, itertools, heapq, collections, bisect, string, copy
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7
ans = count = 0; pro = 1

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

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

max_num = max(b)
min_num = min(b)

print(max_num - min_num)

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

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

print(max(ls_a) - min(ls_a))

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

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

Solution (Python):
def examB():
    N = I()
    A = LI()
    ans = max(A)-min(A)
    print(ans)


import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

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

import sys


def solve(N: int, A: "List[int]"):
    As = sorted(A)
    print(As[-1] - As[0])


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(" ")))
As=sorted(A)
print(As[N-1]-As[0])

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

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

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

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


mn = An[0]
mx = An[0]
for i in An:
    if mn > i:
        mn = i
    if mx < i:
        mx = i

print(mx - mn)

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

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

res = max([abs(x - y) for x, y in itertools.combinations(An, 2)])

print(res)

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

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

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

Solution (Python):
n = int(input())
list_a = list(map(int, input().split()))
print(max(list_a) - min(list_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()))
A.sort()
print(abs(A[0]-A[-1]))

Solution (Python):
length = int(input())
inp = input().split(' ')
A = []
for i in range(0, length):
  A.append(int(inp[i]))
print(max(A) - min(A))

Solution (Python):
import sys
input = sys.stdin.readline
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()))

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

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

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()))
ans = abs(max(a)-min(a))
print(ans)

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

a.sort()

s = a[0]
t = a[len(a)-1]




print(abs(t-s))

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 = 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[-1] - A[0])

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

a = sorted(a)

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

Solution (Python):

count = int(input())
num = input().split()
a = []
for i in num:
    a.append(int(i))

a = sorted(a)

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

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

print(max(al) - min(al))

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

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

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

print(max(num_list)-min(num_list))

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

A1 = sorted(A , reverse =True)

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

Solution (Python):
N = int(input())
As = [int(A) for A in input().split()]
max_As = 0
min_As = 10e9
for A in As:
    if A > max_As:
        max_As = A
    if A < min_As:
        min_As = A
print(max_As - min_As)

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

ans = 0
for i, num in enumerate(A_list):
  for j, n in enumerate(A_list):
    if i == j:
      continue
    s = abs(A_list[i] - A_list[j])
    if s > ans:
      ans = s
print(ans)

Solution (Python):

n = int(input())
a = [int(s) for s in input().split()]

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

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))

li.sort()

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

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

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

main()

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

print(max(numbers)-min(numbers))

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

Solution (Python):
N = int(input())
Alist = list(map(int, input().split()))
max_num = 0
for A in Alist:
    for A_ in Alist:
        sbn = abs(A - A_)
        max_num = sbn if sbn > max_num else max_num
print(max_num)

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

Solution (Python):



import sys













def main():
    n, *a = (int(x) for x in sys.stdin.read().split())
    a.sort()
    print(a[-1] - a[0])


if __name__ == "__main__":
    
    main()

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

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

Solution (Python):
import itertools

n = int(input())
A = list(map(int, input().split()))
ans = -float('inf')
cn = itertools.combinations(A, 2)

for a, b in cn:
    cnt = abs(a-b)
    ans = max(ans, cnt)

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

max_val = abs(a[0] - a[1])
for i in range(len(a)):
    for j in range(i, len(a)):
        if abs(a[i] - a[j]) > max_val:
            max_val = abs(a[i] - a[j])
print(max_val)

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

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

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

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()))
a_abs = [abs(i) for i in a]
print(max(a_abs) - min(a_abs))

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

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

min = arry[1]
max = arry[1]


for i in range(len(arry)):
  if arry[i] < min:
    min = arry[i]
  if arry[i] > max:
    max = arry[i]

print (max-min)

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

maxInt = max(A)
minInt = min(A)
ans = abs(maxInt - minInt)

print(ans)

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

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

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

ans = 0

for i in range(len(li)-1):
    for j in range(i+1, len(li)):
        if(ans < abs(li[i] - li[j])):
            ans = abs(li[i] - li[j])

print(ans)

Solution (Python):
N = input()
A = [int(a) for a in 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, *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()))

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

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

max_value=0
for i in range(n-1):
    base_value=a_list[i]
    for j in range(i,n):
        max_value=max(max_value, abs(base_value-a_list[j]))

print(max_value)

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

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

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a_min=float('inf')
a_max=0
for i in a:
    a_min = min(a_min,i)
    a_max = max(a_max,i)
print(a_max-a_min)

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

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

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

print(max(arr)-min(arr))

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

print(max)

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

Solution (Python):
"""
author : halo2halo
date : 25,Oct,2019
"""

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

N = int(readline().rstrip())
lis = list(map(int, readline().rstrip().split()))
a = sorted(lis)

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

Solution (Python):



import unittest
from io import StringIO
import sys


def input():
    return sys.stdin.readline().rstrip()


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


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4
1 4 6 3"""
        output = """5"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2
1000000000 1"""
        output = """999999999"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """5
1 1 1 1 1"""
        output = """0"""
        self.assertIO(input, output)


if __name__ == "__main__":
    
    resolve()

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

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

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

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

A_sorted = sorted(A) 

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

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

AA=[]
for i in range(N):
    for j in range(i+1,N):
        AA.append(abs(A[i]-A[j]))
print(max(AA))

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

Solution (Python):
n = int(input())
nums = list(map(int,input().split()))
n_min = nums[0]
n_max = nums[1]
for num in nums[0:] :
  if num < n_min :
    n_min = num
  elif num > n_max:
    n_max = num
print(n_max-n_min)

Solution (Python):
N = input()
A_list = input().split()

A_list_int = list(map(int, A_list))

max = max(A_list_int)
min = min(A_list_int)

print(max - min)

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

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

Solution (Python):
N = int(input())
nums = [int(e) for e in input().split()]
ans = 0
for i in nums:
    for k in nums:
        sub = abs(i-k)
        if sub > ans:
            ans = sub
print(ans)

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

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

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

max_num = 0
min_num = 10**9+1

for i in l:
    max_num = max(max_num,i)
    min_num = min(min_num,i)
    
print(max_num - min_num)

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

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

Solution (Python):


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


if __name__ == "__main__":
    resolve()

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

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

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

N,*A = map(int,read().split())

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

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

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

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

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

big = max(a)
small = min(a)
print(big-small)

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

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

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

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

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

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

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

Solution (Python):

N = int(input()) 
A_list = [int(e) for e in input().split()] 

abs_of_A_list = [abs(i) for i in A_list]

print(max(abs_of_A_list)-min(abs_of_A_list))

Solution (Python):

N = int(input())
A = input().split()

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

saidai = max(A)
saitei = min(A)

print(saidai-saitei)

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

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

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

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

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

A = sorted(A)
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

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

Solution (Python):
_ = 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):
a = int(input())
num =  list(map(int, input().split()))
b, c = max(num), min(num)

print(b-c)

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline


def main():
    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)
            

if __name__ == '__main__':
    main()

Solution (Python):


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

a = max(A)
b = min(A)
print(a-b)

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

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

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

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

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

max= max(L)
min = min(L)

print(max - min)

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

max=max(l)
min=min(l)

print(max-min)

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

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