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

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

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

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

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

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

B = []

for i in A:
    B.append(i)

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

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

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

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


if __name__ == '__main__':
    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 = [int(a) for a in input().split()]
A_list.sort()
print(A_list[-1]-A_list[0])

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

Solution (Python):
N = int(input())
A = [int(i) for i in 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[n-1]-a[0])

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

Solution (Python):

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

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

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

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

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

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

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

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

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

amax = (max(a))
amin = (min(a))

res = abs(amax-amin)
print (res)

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

Solution (Python):




def maxDiff(str) :
	numList = list(map(int, str.split()))
	numList.sort()
	maxdiffint = numList[-1]-numList[0]
	ans = maxdiffint
	return ans


if __name__ == '__main__':
	_ = input()
	inputStr = input()
	ans=maxDiff(inputStr)
	print(ans)

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

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

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

    return max(a) - min(a)


print(abc102_b())

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

print(max(li) - min(li))

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

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

idx_of_min = idx_of_max = 0
for i in range(n):
    if a[i] < a[idx_of_min]:
        idx_of_min = i
    if a[i] > a[idx_of_max]:
        idx_of_max = i

print(a[idx_of_max] - a[idx_of_min])

Solution (Python):
def main():
    n = int(input())
    nums = input().split()
    for i in range(len(nums)):
        nums[i] = int(nums[i])
    max_diff = 0
    for i in range(len(nums)):
        for j in range(i, len(nums)):
            diff = abs(nums[i] - nums[j])
            if diff > max_diff:
                max_diff = diff
    print(max_diff)

main()

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

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

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

idx_of_min, idx_of_max = 0, 0
for i in range(n):
    if a[i] < a[idx_of_min]:
        idx_of_min = i
    if a[i] > a[idx_of_max]:
        idx_of_max = i

print(a[idx_of_max] - a[idx_of_min])

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

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

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

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

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

idx_of_min = 0
idx_of_max = 0
for i, a_i in enumerate(a):
    if a_i < a[idx_of_min]:
        idx_of_min = i
    if a_i > a[idx_of_max]:
        idx_of_max = i

print(a[idx_of_max] - a[idx_of_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()))

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

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

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

Solution (Python):
n = int(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()]

A_max = max(A_list)
A_min = min(A_list)
ans = abs(A_max - A_min)
print(ans)

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

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

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

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

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

Solution (Python):


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

Solution (Python):



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


if __name__ == '__main__':
    main()

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

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

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

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

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

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

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

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

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

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

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

Solution (Python):

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

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

print(max(b)-min(b))

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

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

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

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

x = max(a)
y = min(a)

print(x - y)

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

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

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

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

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

Max = 0
Min = 10 ** 9

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

print(Max - Min)

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

max_answer = 0

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

print(max_answer)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
from sys import stdin


def main() -> None:
    n = next_int()
    mx = mn = 0

    for i in range(n):
        ai = next_int()
        if i == 0:
            mx = mn = ai
        else:
            mx = max(mx, ai)
            mn = min(mn, ai)

    print(mx - mn)


def next_int() -> int:
    return int(next_str())


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

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

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

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

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

L.sort()

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

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

nums.sort()
max = nums[-1]
min = nums[0]
tmp = abs(max-min)
for i in range(len(nums)):
  if tmp < abs(max - nums[i]):
    tmp = abs(max - nums[i])

print(tmp)

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

Solution (Python):

input()
print((lambda x: x[-1]-x[0])(sorted(list(map(int, input().split())))))

Solution (Python):
import numpy as np

count = int(input())

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

print(max(array_1) - min(array_1))

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

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

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

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

b = []
for i in range(n):
    for j in range(i+1,n):
        b.append(abs(a[i] - a[j]))

print(max(b))

Solution (Python):


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

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

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

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

Solution (Python):
N = int(input())
H = [int(i) for i in input().split()]
H = sorted(H)
print(abs(H[0]-H[N-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()))
res = 0
for i in range(n-1):
    for j in range(i+1,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):
input();n=list(map(int,input().split()))
print(max(n) - min(n))

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

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
max = 0
for a1 in a:
    for a2 in a:
        if max < abs(a1 - a2):
            max = abs(a1 - a2)

print(max)

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

ans = -1

for i in range(len(a)):
    for j in range(len(a)):
        if i != j:
            if abs(a[i] - a[j]) > ans:
                ans = abs(a[i] - a[j])


print(ans)

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

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

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

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

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

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

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

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

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

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

print(max(li) - min(li))

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

print(list_n[-1] - list_n[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):
from sys import stdin

N = int(stdin.readline().rstrip())
lst = [int(a) for a in stdin.readline().rstrip().split()]

a = max(lst)
b = min(lst)

print(abs(a - b))

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

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

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

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

Solution (Python):
N = int(input())
    
value = []
for part in input().split():
    value.append(int(part))
    
print(max(value) - min(value))

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

Solution (Python):

d=int(input())
n=[int(i) for i in input().split()]
n.sort()
print(n[len(n)-1]-n[0])

Solution (Python):

"""
B - Maximum Difference


"""
import sys
from sys import stdin
input = stdin.readline


def solve(arr):
    return max(arr) - min(arr)


def main(arg):
    N = int(input())
    arr = [int(a) for a in input().split()]
    ans = solve(arr)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

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

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

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

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

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

list1.sort()
print(list1[n-1]-list1[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 = list(map(int, input().split()))
print(max(a_list) - min(a_list))

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

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

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

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

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

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

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

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

Solution (Python):
num=int(input())
alist=[int(i) for i in input().split()]
dif=0
for i in range(num):
    for j in range(i,num):
        tmp=abs(alist[i]-alist[j])
        if tmp>dif:
            dif=tmp
print(dif)

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

Solution (Python):
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())
list=[int(x) for x in input().split()]
mini=list[0]
maxi=list[0]
for k in range(1,n):
    if mini>list[k]:
        mini=list[k]
    elif maxi<list[k]:
        maxi=list[k]
print(maxi-mini)

Solution (Python):
n=int(input())
a=[int(x) for x in str(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())
list=[ int(x) for x in input().split()]
ma=max(list)
mi=min(list)
print(ma-mi)

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

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

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

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

Solution (Python):

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

Solution (Python):
def solution(a):
    return max(a) - min(a)

def main():
    n = int(raw_input().strip())
    a = [int(i) for i in raw_input().strip().split()]
    print solution(a)

if __name__ == '__main__':
    main()

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

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()))
mina = A[0]
maxa = A[0]
for a in A:
    if mina > a:
        mina = a
    if maxa < a:
        maxa = a

print(abs(maxa - mina))

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

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

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

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

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

big = max(A)
small = min(A)
print(abs(big - small))

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

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


c=sorted(b)

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

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

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

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

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

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

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

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

Solution (Python):
n = int(input())
a = 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()))

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=[int(i) for i in input().split()]
a_list.sort()
diff=a_list[n-1]-a_list[0]
print(diff)

Solution (Python):


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

    a_min = 1000000000
    a_max = 0
    for a_i in a:
        a_min = min(a_min, a_i)
        a_max = max(a_max, a_i)

    ans = a_max - a_min
    print(ans)

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

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

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

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

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

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

Solution (Python):
N = int(input())
lists = [int(i) for i in input().split()]
cla = 0
for x in lists:
    for y in lists:
        c = abs(x - y)
        if (c > cla):
            cla = c
print(cla)

Solution (Python):


def getMinMax(A):
    nmin = 10**9+1
    nmax = 0
    for ai in A:
        if nmin > ai:
            nmin = ai
        if nmax < ai:
            nmax = ai
    return nmin, nmax

def getAbs(minmax):
    return abs(minmax[0] - minmax[1])

if __name__ == "__main__":
    N = int(input())
    A = [int(x) for x in input().split()]
    print(getAbs(getMinMax(A)))

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

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

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

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

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

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

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

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

list_A = [ int(i) for i in input().split()]

max_A = max(list_A)
min_A = min(list_A)

print(max_A - min_A)

Solution (Python):


from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


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


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
times = int(input())
lis = [int(m) for m in input().split()]
print(max(lis) - min(lis))

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

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

Solution (Python):
N = int(input())
a = list(int(i) for i in input().split())
a.sort(reverse = True)
print(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())
a = list(map(int, input().split()))
print(abs(min(a) - max(a)))

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

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

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

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

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

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

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

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

Solution (Python):
n = int(input())
a_list = [int(ai) for ai in input().split()]
maxv, minv = max(a_list), min(a_list)
print(abs(maxv - minv))

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

s = list(map(int, input().rstrip().split(" ")))
maxnum = s[0]
minnum = s[0]

for i in range(1, n): 
    if s[i] > maxnum:
        maxnum = s[i]
    if s[i] < minnum:
        minnum = s[i]

print(maxnum - minnum)

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

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

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

Solution (Python):
N = int(input())
a = input().split()
a = list(map(int, a))
b_max = 0 
for i in a:
    for k in a:
        b = abs(i-k)
        if b > b_max:
            b_max = b

print(b_max)

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())
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()))
m = -float("inf")
for i in range(N):
    for j in range(N):
        m = max(abs(A[i] - A[j]), 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 = [int(_) for _ in input().split(' ')]
print(max(a) - min(a))

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

Solution (Python):

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

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

ABS = maxA - minA

print(ABS)

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

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

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

max = 0
min = 1000000000
for i in range(0,n):
  v=int(a[i])
  if max<v:
    max = v
  if min>v:
    min = v

print(max-min)

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

k = list(int(i) for i in input().split())  

print(int(max(k)) - int(min(k)))

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

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

print(ans)