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

Number = list(S)

Maxi = max(Number)
Mini = min(Number)

print(Maxi - Mini)

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

answer=max(a)-min(a)

print(answer)

Solution (Python):
n=int(input())
*a,=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):
        if i == j: continue
        ans = max(ans, abs(A[i]-A[j]))
print(ans)

Solution (Python):
import sys

input = sys.stdin.readline
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())
min_A = 10**9+7
max_A = -1
for i in input().split():
  tmp = int(i)
  max_A = max(tmp,max_A)
  min_A = min(min_A,tmp)
  
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()))
ans=0
for i in range(n):
    for j in range(i+1,n):
        ans=max(abs(a[i]-a[j]),ans)
print(ans)

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

ans = 0
for i in range(N):
    for j in range(N):
        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()))
cmax = 0
for i in range(N-1):
    for j in range(i+1,N):
        cmax = max(cmax,abs(A[i]-A[j]))
print(cmax)

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):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
print(max(a) - min(a))

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

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

answer = (max(num_list) - min(num_list))

print(answer)

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

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

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

max = 0
min = 1000000000

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

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

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

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

max = max(num)
min = min(num)

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

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

Solution (Python):
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

a = k()
b = l()
b.sort()

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

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()))
sub = []

for i in A:
    for j in A:
        sub.append(abs(i - j))

descending_sub = sorted(set(sub), reverse=True)


print(descending_sub[0])

Solution (Python):
def mapt(fn, *args):
    return list(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n = int(input())
    a = Input()
    print(max(a) - min(a))


main()

Solution (Python):


import itertools


def get_input() -> tuple:
    """
    標準入力を取得する.

    Returns:\n
        tuple: 標準入力
    """
    N = int(input())
    A = list(map(int, input().split()))

    return N, A


def main(A: list) -> None:
    """
    メイン処理.

    Args:\n
        A (list): 整数列(1 <= A_i <= 10^9)
    """
    
    ans = 0
    for A_i, A_j in itertools.combinations(A, r=2):
        ans = max(ans, abs(A_i - A_j))

    
    print(ans)


if __name__ == "__main__":
    
    N, A = get_input()

    
    main(A)

Solution (Python):


def get_input() -> tuple:
    """
    標準入力を取得する.

    Returns:\n
        tuple: 標準入力
    """
    N = int(input())
    A = list(map(int, input().split()))

    return N, A


def main(A: list) -> None:
    """
    メイン処理.

    Args:\n
        A (list): 整数列(1 <= A_i <= 10^9)
    """
    
    ans = max(A) - min(A)

    
    print(ans)


if __name__ == "__main__":
    
    N, A = get_input()

    
    main(A)

Solution (Python):

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


ma=a.index(max(a))
mi=a.index(min(a))

print(a[ma]-a[mi])

Solution (Python):


import itertools


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


ans = 0
for A_i, A_j in itertools.combinations(A, r=2):
    ans = max(ans, abs(A_i - A_j))


print(ans)

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

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

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

Solution (Python):
n=int(input()) 
lista=input().split() 
p=int(lista[0])
q=int(lista[0])
for i in range(1,n):
    k=int(lista[i])
    if k<=p:
        p=k
    elif k>=q:
        q=k
print(int(q-p))

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

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

for i in range(N):
    for j in range(N):
        if i == j:
            continue
        else:
            ABS = abs(A[i] - A[j])
            M.append(ABS)
            
print(max(M))

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

Solution (Python):
S_list = [input() for i in range(2)]
N = map(int,S_list[0].split())    
A_list = list(map(int,S_list[1].split()))

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

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

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

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

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

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

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

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

Amax = max(A)
Amin = min(A)

ans = Amax - Amin
print(ans)

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

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

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

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

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

for i in range(n):
  for j in range(i,n):
    num1 = abs(num[i]-num[j])
    if ans <= num1:
      ans = num1
print(ans)

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

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

def answer(n: int, a: list) -> int:
    return max(a) - min(a)
print(answer(n, a))

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

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

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

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

print(max(d) - min(d))

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

Solution (Python):



N = int(input())
my_list = list(map(int, input().split(maxsplit=N)))

my_list_sort = sorted(my_list, reverse=True)
answer = my_list_sort[0] - my_list_sort[-1]

print(answer)

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

print(max(A1)-min(A1))

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

difference = max(A) - min(A)

print(difference)

Solution (Python):

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

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

result = 0;

for i in Nums:
    for ii in Nums:
        if result < abs(i - ii):
            result = abs(i - ii)
print(result)

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

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

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

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

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

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

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

Solution (Python):

lnum = int(input())
lint = list(map(int, input().split()))


difference = abs(max(lint) - min(lint))
print(difference)

Solution (Python):


def atc_102b(N: int, Ai_input: str) -> int:
    Ai = [int(i) for i in Ai_input.split(" ")]
    return max(Ai) - min(Ai)

N_input_value = int(input())
Ai_input_value = input()
print(atc_102b(N_input_value, Ai_input_value))

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

value_max = abs(max(A)) - abs(min(A))

print(value_max)

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

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

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

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

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

def ans102(N:int, A:list):
    A=sorted(map(int,A))
    return(A[N-1]-A[0])

print(ans102(N,A))

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

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

Solution (Python):
def answer(n: int, a: []) -> int:
    return max(a) - min(a)


def main():
    n = int(input())
    a = list(map(int, input().split()))
    print(answer(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):
import itertools
N = int(input())
A = list(map(int, (input().split())))

answer = 0
for i,j in itertools.combinations(A,2):
    answer = max(answer, abs(i - j))

print(answer)

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):
import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
n, = [int(num) for num in lines.pop(0).split(" ")]
a_list = [int(num) for num in lines.pop(0).split(" ")]
ans = max(a_list) - min(a_list)
print(ans)

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

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

ls = list(combinations(A,2))

ans = 0
for (a,b) in ls:
  ans = max(ans, abs(a - b))
  
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):
        if abs(a[i] - a[j]) > ans:
            ans = abs(a[i] - a[j])
print(ans)

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

Solution (Python):

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

Solution (Python):
import sys
mapin = lambda: map(int, sys.stdin.readline().split())
listin = lambda: list(map(int, sys.stdin.readline().split()))
inp = lambda: sys.stdin.readline()

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

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

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

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

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)

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    A = list(map(int, readline().split()))

    ans = 0

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

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):

import sys
import math
import numpy as np
import itertools


n = int(input())


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

mi=1000000001
ma=0
for i in range(n):
    if a[i] > ma:
        ma = a[i]
    if a[i] < mi:
        mi = a[i]

print(ma-mi)

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

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

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

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

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

max = max(list)
min = min(list)

m = max-min

print(m)

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

print(abs(max - min))

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

Solution (Python):
count=input()
list=input().rstrip().split(" ")
list_1=[int(s) for s in list]
list2= sorted(list_1)
sa=(max(list2)-min(list2))
if sa<0:
  print(-1*sa)
else:
  print(sa)

Solution (Python):
count=input()
list=input().rstrip().split(" ")
list_1=[int(s) for s in list]
list2= sorted(list_1)
sa=(list2[0]-list2[int(count)-1])
if sa<0:
  print(-1*sa)
else:
  print(sa)

Solution (Python):
count=input()
list=input().rstrip().split(" ")
list_1=[int(s) for s in list]
list2= sorted(list_1)
sa=(int(list2[0])-int(list2[int(count)-1]))
if sa<0:
  print(-1*int(sa))
else:
  print(int(sa))

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

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

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

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

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

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

Solution (Python):



def main():
    n = int(input())
    li = list(map(int, input().split()))
    a = b = li[0]
    for i in li:
        a = min(a, i)
        b = max(b, i)
    print(b - a)


if __name__ == "__main__":
    main()

Solution (Python):



def main():
    N, *A = map(int, open(0).read().split())
    print(max(A) - min(A))


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

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

max_diff = max_A - min_A
print(max_diff)

Solution (Python):


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

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

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

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

num_min = min(num_list)
num_max = max(num_list)

print(num_max - num_min)

Solution (Python):
n = 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()))
l = [0]*n**2
j = 0
b = 0

for i in a:
    for j in range(n):
        l[b]=i-a[j]
        b+=1
        
print(abs(max(l)))

Solution (Python):
from itertools import combinations
N = int(input())
res = 0
for a, b in combinations(map(int, input().split()),2):
    res = max(abs(a-b), res)
print(res)

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

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

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

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

for i in range(n):
  for j in range(i,n):
    ans.append(abs(l[i]-l[j]))
print(max(ans))

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

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

min_v=l[0]
max_v=l[0]

for i in range(n):
  if min_v > l[i]:
    min_v=l[i]
  if max_v < l[i]:
    max_v=l[i]

print(max_v-min_v)

Solution (Python):
N =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 ()]
Ma = max (A)
Mi = min (A)
print (Ma - Mi)

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

max_dif = 0
dif = 0

for i in range(0, N):
    for j in range(i+1, N):
        dif = abs(A[i]-A[j])
        if max_dif < dif:
            max_dif = dif

print("{}".format(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()))

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

print(ans)

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

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

ans = l[n-1]-l[0]

print(ans)

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

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

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

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

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

max = 0
min = 1000000000

for i in nums:
    if i>max:
        max = i
    if i<min:
        min = i
    
print(max-min)

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

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

max = 0

for i in nums:
    for j in nums:
        if abs(i-j) > max:
            max = abs(i-j)
        
print(max)

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

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())
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):
def sa(x,j):
    c=[]
    for i in range(1,len(x)):
        c.append(abs(int(x[j])-int(x[i])))
    return max(c)

N=int(input())
A=list(map(str,input().split()))
ans=0
for j in range(N):
    y=sa(A,j)
    if y>ans:
        ans=y

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

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

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

print(max(x)-min(x))

Solution (Python):




import sys
from io import StringIO
import unittest


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)


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

x.sort()

answer = x[-1] - x[0]

print(answer)

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

ans = 0
for i in range(1,N):
    for j in range(i):
        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()))
a = sorted(a)
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(abs(A[i]-A[j]),ans)
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()))

maxa = 0
mina = 10**9

for a in A:
    if maxa < a:
        maxa = a
    if mina > a:
        mina = a

print(maxa-mina)

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

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

	print(abs(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):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    return


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
li = sorted(rl())
print(li[-1] - li[0])

Solution (Python):









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

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

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

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

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

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

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, *aaa = map(int, open(0).read().split())
print(max(aaa) - min(aaa))

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

ala = list(map(lambda x: abs(x),al))

ma =max(ala)
mi =min(ala)

print(ma-mi)

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

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

x = max(list)
y = min(list)
print(x - y)

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


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


if __name__ == '__main__':
    main()

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