Problem:
 Score : 200 points    Problem Statement You are given an integer sequence A of length N .
Find the maximum absolute difference of two elements (with different indices) in A .      Constraints  2 \leq N \leq 100  1 \leq A_i \leq 10^9  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  A_1  A_2  ...  A_N       Output Print the maximum absolute difference of two elements (with different indices) in A .        Sample Input 1 4
1 4 6 3      Sample Output 1 5  The maximum absolute difference of two elements is A_3-A_1=6-1=5 .       Sample Input 2 2
1000000000 1      Sample Output 2 999999999       Sample Input 3 5
1 1 1 1 1      Sample Output 3 0

Solution (Python):
def sub(i,li):
    j = i + 1
    sub_max = 0
    for k in range(len(li) - j):
        if sub_max < abs(li[j] - li[i]):
            sub_max = abs(li[j] - li[i])
        j += 1
    return sub_max

n = int(input())
li = list(map(int,input().split()))
max_num = 0
for i in range(len(li)):
    a = sub(i,li)
    if a > max_num:
        max_num = a
print(max_num)

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


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

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

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

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

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

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

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

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

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

for i in range(n):
    for j in range(n):
        ans.append(abs(A[i] - A[j]))

print(max(ans))

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

for i in A:
    A1 = i
    for j in A:
        A2 = j
        a.append(abs(A1 - A2))
print(max(a))

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

for ai in a:
    for aj in a:
        diff.append(abs(ai - aj))
print(max(diff))

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

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

Solution (Python):

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np

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

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

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

Solution (Python):
from sys import stdin


def main():
    _ = input()
    A = [int(x) for x in stdin.readline().split()]
    print(max(A) - min(A))


if __name__ == "__main__":
    main()

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

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

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

ans = 0

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

print(ans)

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

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

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

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

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

A_min = min(A)
A_max = max(A)

print(A_max - A_min)

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

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

Solution (Python):
if __name__ == '__main__':
    N= int(input())
    A_list = list(map(int, input().split()))

    min_A = min(A_list)
    max_A = max(A_list)
    
    print(max_A - min_A)

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

Solution (Python):

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

mx=0
for x in l:
  for y in l:
    mx=max(mx,abs(x-y))


print(mx)

Solution (Python):

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

max_ = max(A)
min_ = min(A)
print(max_ - min_)

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

Solution (Python):
n = input()
num_list = sorted([ int(v) for v in input().split() ])
print(num_list[-1]-num_list[0])

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

tmp = 0
for i in range(N):
    a1 = A[i]
    for j in range(N):
        a2 = A[j]
        if tmp < abs(a1 - a2):
            tmp = abs(a1 - a2)

print(tmp)

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

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

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

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

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

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

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

min_A = float('inf')
max_A = -1

for i in range(N):
    if A[i] < min_A:
        min_A = A[i]
    if A[i] > max_A:
        max_A = A[i]


print(max_A - min_A)

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

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

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

Solution (Python):

import sys


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

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

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

Solution (Python):
import statistics

def main():
    num = int(input())
    data = list(map(int, input().split()))
    data.sort()
    print(data[-1] - data[0])



if __name__ == '__main__':
    main()

Solution (Python):
import math

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

Solution (Python):


N = int(input())

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

ma = max(vals)
mi = min(vals)

print(abs(ma-mi))

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

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

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

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

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    a = f()
    print(max(a) - min(a))

solve()

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

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

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

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

Solution (Python):
n = int(input())
li = input().split()
li = [int(s) for s in li]
l=len(li)
 
ans = 0

for m in range(l):
    for n in range(l):
        x = abs(li[n]-li[m])
        if x>ans:
            ans = x;
print(ans)

Solution (Python):
n = int(input())
diff = 0
a = [int(x) for x in input().split()]
for i in range(n):
    for j in range(i+1,n):
        d = abs(a[i]-a[j])
        if d > diff:
            diff = d
print(diff)

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

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

Solution (Python):
from sys import stdin


def main():
    _ = int(stdin.readline().rstrip())
    As = [int(x) for x in stdin.readline().rstrip().split()]
    As = sorted(As)
    print(As[-1] - As[0])


if __name__ == "__main__":
    main()

Solution (Python):
from sys import stdin

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]

min_number = 10 ** 10
max_number = 0

for k in A:
    if k > max_number:
        max_number = k
    if k < min_number:
        min_number = k

print(max_number - min_number)

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

Solution (Python):

import sys


def solve(N: int, A: "List[int]"):
    A.sort()
    ret = A[-1] - A[0]
    print(ret)
    return


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 = [int(_) for _ in input().split()]
print(max(A) - min(A))

Solution (Python):


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance





def main():
    n = intin()
    alist = intina()

    ans = 0

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

    print(ans)


if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

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

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

i = 0

abs_lst = []

while (i < n - 1):
	j = i + 1
	while (j < n):
		abs_lst.append(abs(a[i] - a[j]))
		j += 1
 
	i = i + 1
    
print(max(abs_lst))

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

comb = list(itertools.combinations(A,2))
diff = [abs(i[0]-i[1]) for i in comb]
print(max(diff))

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()]
B=[]
for i in range(N):
    for k in range(i+1,N):
        B.append(abs(A[i]-A[k]))

print(max(B))

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

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

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

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

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

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

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

Solution (Python):


def solve():
    N = input()
    A = list(map(int, input().split()))
    min_a = float("inf")
    max_a = 0
    for a in A:
        min_a = min(min_a, a)
        max_a = max(max_a, a)
    print(max_a - min_a)

if __name__ == "__main__":
    solve()

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

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

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

Solution (Python):
_ = 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):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    c = 0
    d = 10**9+1 

    for i in range(n):
        c = max(a[i], c)
        d = min(a[i], d)

    print(c-d)

if __name__=='__main__':
    main()

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

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

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

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

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

a.sort()


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

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

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

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


if __name__ == "__main__":
  main()

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

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()))
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()))
A.sort()

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

print(range)

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

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

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

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

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

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

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

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

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

if max(A) > abs(min(A)):
    print(max(A) - min(A))
else:
    print(abs(min(A) - max(A)))

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

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

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

Solution (Python):

import numpy as np
import math
import re
n = int(input())
a = input()
a = re.split(" ",a)

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())
numbers = list(map(int,input().split()))
max = 0
min = 10**9
for i in numbers:
    if i < min:
        min = i
    if i >max:
        max = i
print(max-min)

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

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

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

print(x)

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

a = list(map(int, input().split()))
for i in range(len(a)):
    for j in range(len(a)):
        mx = max(mx,abs(a[i]-a[j]))
print(mx)

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

Solution (Python):

import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int, A: "List[int]"):
    return 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) ]  
    result = solve(N, A)
    print(result)

if __name__ == '__main__':
    main()

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

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
ans=0
for i in range(N):
    for j in range(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):
n = int(input())
a = list(map(int,input()
.split()))
min = pow(10,9)

max = 1
for i in range(n):
    if a[i]<min:
        min = a[i]
    if a[i]>max:
        max = a[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())
an = list(map(int,input().split()))
an.sort()
print(an[N-1]-an[0])

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

print(ans)

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

Solution (Python):
import sys

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

print(sorted(a_list)[-1] - sorted(a_list)[0])

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
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):
import sys
input = sys.stdin.readline

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

Solution (Python):
n,*a=map(int,open(0).read().split())
m=0
for i in range(n-1):
  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 = list(map(int, input().split()))
ans = 0
for i, x in enumerate(a):
    for j, y in enumerate(a):
        if i == j:
            continue
        ans = max(ans, abs(y - x))
print(ans)

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

maxA = max(a)
minA = min(a)

ans = maxA - minA
print(ans)

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

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

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

a.sort()

b = abs(a[N-1]-a[0])

print(b)

Solution (Python):


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

Solution (Python):

n = int(input())
lst = list(map(int, input().rstrip().split()))
max_dif = 0

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

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

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

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

print(max(Aset)-min(Aset))

Solution (Python):

if __name__ == '__main__':
    n = input()
    s = input()
    a = [int(i) for i in s.split()]
    mina = min(a)
    maxa = max(a)
    print(maxa - mina)

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

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

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

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())
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()))
max_a = max(a)
min_a = min(a)
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):
count = int(input())
number = map(int,input().split())

n_list= sorted(list(number))

n_count=count-1
answer= n_list[n_count]- n_list[0]

print(answer)

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

Solution (Python):

num = int(input())
num_list = input()
new = num_list.split(" ")

min=int(new[0])
max=int(new[0])
for i in range(num):
  if min>int(new[i]):
    min=int(new[i])
  if max<int(new[i]):
    max=int(new[i])
print(max-min)

Solution (Python):


n = int(input())

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

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

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

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


if __name__ == '__main__':
	main()

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

print(ans)

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

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

list_sort=sorted(list_a)
a = list_sort[0]
b = list_sort[-1]
print(b-a)

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

sort = sorted(nums)
print(abs(sort[-1] - sort[0]))

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

ans=0
for x in A:
	for y in A:
		ans=max(abs(y-x), ans)

print(ans)

Solution (Python):

N=int(input())
A = [int(j) for j in input().split()]
A.sort()
print(abs(A[N-1]-A[0]))

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

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

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

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

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

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

print(abs(a[n-1] - a[0]) if len(a) >= 2 else 0)

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

Solution (Python):
import itertools
N = int(input())
A = list(map(int, input().split()))
    
X = 0
for v in itertools.combinations(A, 2):
    if abs(v[0] - v[1]) > X:
        X = abs(v[0] - v[1])
        
print(X)

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

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

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

Solution (Python):
N = int(input())
A = list(map(int, 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()))
ans = 0

from itertools import combinations

for i, j in combinations(A, 2):
    ans = max(ans, abs(i - j))

print(ans)

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

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

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

min = 10**10
max = -100
for i in A:
  if (min >= i):
    min = i
  if (max <= i):
    max = i
print(max - min)