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

Solution (Python):



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

minval = 10 ** 10
maxval = 0
for i in range(n):
    if a[i] > maxval:
        maxval = a[i]
    if a[i] < minval:
        minval = a[i]

print(abs(maxval - minval))

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

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

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

A = list(map(int,input().split()))
new_A = sorted(A,reverse=True)
print(new_A[0] - new_A[-1])

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

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

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

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

print(ans)

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

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

print(ans)

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

Solution (Python):

import sys
INF = float("inf")


def solve(N: int, A: "List[int]"):
    A.sort()
    print(A[-1]-A[0])
    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=list(map(int,input().split()))
print(sorted(A)[-1]-sorted(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 = [int(i) for i in input().split()]
print(max(a_list)-min(a_list))

Solution (Python):
_,a=open(0);*a,=map(int,a.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()] 

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

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

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

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

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

a = sorted(a)

dmax = a[-1] - a[0]

print(dmax)

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

x.sort()

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

Solution (Python):
s = input()
li = input().split()
li2 = []
for i in li:
    for j in li:
        s = int(i) -int(j) 
        if s >0:
            li2.append(s)
        else:
            li2.append(s * -1)

li2.sort()
ans = li2[-1]
print(ans)

Solution (Python):
N = input()
string_list = input().rstrip().split()
l = [int(x) for x in string_list]
_max = 0
_min = l[0]
for t in l:
  if _max < t:
    _max = t
  if _min > t:
    _min = t  
print(_max - _min)

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

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

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

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

Solution (Python):
N = int(input())
A = list(map(int, input().rstrip().split()))
maximum = A[0]
minimum = A[0]

for i in A:
    if maximum < i:
        maximum = i
    elif minimum > i:
        minimum = i

print(abs(maximum-minimum))

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

print(max(nums)-min(nums))

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

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

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

A_max=max(A_list)
A_min=min(A_list)

print(A_max-A_min)

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

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

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

Solution (Python):
from sys import stdin
N=int(stdin.readline().rstrip())
data=[int(x) for x in stdin.readline().rstrip().split()]
data=sorted(data)
print(abs(data[0]-data[-1]))

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

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

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

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

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

Solution (Python):
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):
        diff = abs(A[i]-A[j])
        if diff > ans: ans = diff

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

Solution (Python):


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

maxlen = 0

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

print(maxlen)

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

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

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

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

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

print(ans)

Solution (Python):
N = int(input())
A = input().split(" ")
B = [int(n) for n in A]
             
m = float("inf")
M = 0
for b in B:
  if b < m:
    m = b
              
  if b > M:
    M = b
             
print(M-m)

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

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

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
min = 1000000000
max = 0
for i, a in enumerate(A):
    if i == 0:
        max = a
        min = a

    if a > max:
        max = a
    elif a < min:
        min = a
print(max - min)

Solution (Python):

N = int(input())
As = map(int, input().split())

Amin = 10**9 + 1
Amax = 0

for A in As:
    if A < Amin:
        Amin = A
    if A > Amax:
        Amax = A

print(Amax - Amin)

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

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

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

Solution (Python):
n,a=int(input()),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(a) for a in input().split()]

absmax = 0

for i, a in enumerate(A):
    for b in A[i+1:]:
        absmax = max(absmax, abs(a-b))

print(absmax)

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

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

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

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

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

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

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

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

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

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

print(max(M)-min(M))

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

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

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

Solution (Python):
from sys import stdin
n=int(stdin.readline().rstrip())
a_list=[int(x) for x in stdin.readline().rstrip().split()]
a_list.sort()
print(a_list[n-1]-a_list[0])

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

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

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

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

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

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

Solution (Python):


import sys


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

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

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

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 and abs(a[i]-a[j])>=ans:
            ans=abs(a[i]-a[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())
A = list(map(int,input().split()))
print(max(A)-min(A))

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

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

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

mn = 10**9+1 
mx = 0       

for v in A:
  if v < mn:
    mn = v   
  if v > mx:
    mx = v   

print(mx-mn)

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

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

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

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

Solution (Python):
def solve(string):
    n, *a = map(int, string.split())
    a = sorted(a)
    return str(abs(a[0] - a[-1]))


if __name__ == '__main__':
    print(solve("\n".join([input(), input()])))

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

for i in range(N):
  A[i] = int(A[i])
A.sort()
print(A[-1] - A[0])

Solution (Python):


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

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

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

Solution (Python):
input()
l=list(map(int, input().split()))
import itertools
print(max(abs(x-y) for x,y in itertools.combinations(l, 2)))

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

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

aList = sorted(aList)
print(aList[-1]-aList[0])

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

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

Solution (Python):

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

Solution (Python):
def maximum_difference(N: int, A: list)->int:
    return max(A) - min(A)


if __name__ == "__main__":
    N = int(input())
    A = [int(s) for s in input().split()]
    ans = maximum_difference(N, A)
    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()))
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())
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=input()
A=sorted(list(map(int,input().split())))
print(A[-1]-A[0])

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

sortedA = sorted(A)

answer = sortedA[-1] - sortedA[0]

print(answer)

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

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

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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

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

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

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

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

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

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

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

Solution (Python):

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

Solution (Python):


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

answer = abs(max(a)-min(a))

print(answer)

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 = list(map(int, input().split()))
a = max(A_list)
diff = 0
for i in A_list:
	b = abs(a - i)
	if b > diff:
		diff = b
print(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()))

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

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

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

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

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

Solution (Python):

"""
Created on Tue Feb 26 23:53:42 2019

@author: yuta
"""

def maxdif(n,a):
    b = sorted(list(map(int,a)))
    c = b[n-1] - b[0]
    print(c)

x = int(input())
y = input().split()

maxdif(x,y)

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

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 0
    for i in range(N):
        for j in range(i, N):
            dif = abs(A[i] - A[j])
            if dif > ans:
                ans = dif
    print(ans)


if __name__ == "__main__":
    main()

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

print max(A)-min(A)

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

Solution (Python):
n,*a=map(int,open(0).read().split());print(max(a)-min(a))

Solution (Python):
from itertools import*;n,*a=map(int,open(0).read().split());print(max(abs(i[0]-i[1])for i in combinations(a,2)))

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

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

Solution (Python):
input();*a,=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):
N = int(input())
A = list(map(int, input().split()))
max_n = A[0]
min_n = A[0]
for i in range(N):
    if max_n < A[i]:
        max_n = A[i]
    if min_n > A[i]:
        min_n = A[i]
print(max_n - min_n)

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

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

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

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

Solution (Python):
import sys

def main():
  input = sys.stdin.readline
  N = int(input())
  A = list(map(int, input().split()))
  a, b = min(A), max(A)
  print(b-a)


if __name__ == '__main__':
  main()

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

Solution (Python):
def main() -> None:
    N = int(input())
    A = list(map(int, input().split()))
    AS = sorted(A)
    print(abs(AS[0] - AS[-1]))


if __name__ == '__main__':
    main()

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

max = min = a[0]
for i in range(0,n):
    if max < a[i]:
        max = a[i]
    if min > a[i]:
        min = a[i]
print(max-min)

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

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

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

print(max(list)-min(list))

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

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

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

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

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

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

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

print(abs(max(ar_in)) - abs(min(ar_in)))

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

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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 = []
for i in range(len(a)):
    for j in range(i,len(a)):
        l.append(abs(a[i]-a[j]))
print(max(l))

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

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

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

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

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

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

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

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


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

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

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

ma = max(A)
mi = min(A)

print(ma - mi)

Solution (Python):

"""
Created on Tue Feb 12 15:50:41 2019

@author: shinjisu
"""


import math


def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def zeros(n): return [0]*n


def getIntLines(n): return [int(input()) for i in range(n)]


def getIntMat(n):
    mat = []
    for i in range(n):
        mat.append(getIntList())
    return mat


def dmp(x):
    global debug
    if debug:
        print(x)



def abc100b():
    D, N = getIntList()
    if N % 100 == 0:
        return (N+1) * 100**D  
    else:
        return N * 100**D



def abc101b():
    N = getInt()
    sm = 0
    n = N
    while n > 0:
        sm += n % 10
        n //= 10
    if N % sm == 0:
        return 'Yes'
    else:
        return 'No'



def abc102b():
    N = getInt()
    A = getIntList()
    return max(A) - min(A)


debug = False  
print(abc102b())

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

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

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

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

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

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

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

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

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

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

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

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

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

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

import sys



def solve(lines):
    N = int(lines.pop(0))
    L = list(map(int, lines.pop(0).split(' ')))
    L.sort()
    print(L[-1] - L[0])















lines = [x.strip() for x in sys.stdin.readlines()]




solve(lines)

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):
from statistics import mean, median,variance,stdev
import sys
import math
import fractions

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

x = ip()                              



a = [int(i) for i in 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))


main()

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

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

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

res = 0
for i in range(N):
    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):
N=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()))
margin = 0
for i in range(n):
  for j in range(n):
    margin = max(margin, abs(a[i] - a[j]))
print(margin)

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


if __name__ == '__main__':
    main()

Solution (Python):
""" AtCoder """

import sys
input = sys.stdin.readline
 
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(abs(max(a)-min(a)))

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

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

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

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

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

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

ans = -1
for i in range(n):
    for j in range(n):
        temp = abs(A[i] - A[j])
        ans = max(ans, temp)
        
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()))
s = []
for i in range(n):
    for j in range(n):
        s.append(a[i]-a[j])
print(max(s))

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

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

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

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

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

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

Solution (Python):

import sys

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

res = [0 for _ in range(N*N)]
cnt = 0
for i in range(N) :
    for j in range(N) :
        res[cnt] = abs(A[i] - A[j])
        cnt += 1

print(max(res))

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

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

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

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

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

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

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

dist = max(A_list)-min(A_list)
print(dist)

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

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

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

print(abs(a - b))

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

Solution (Python):
import sys

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

Solution (Python):
N = int(input())
num = [int(j) for j in input().split()]
max = min = num[0]

for i in range(N):
    if max < num[i]:
        max = num[i]
    if min > num[i]:
        min = num[i]

print(max - min)

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

if A[0] != A[N-1]:
    print(A[N-1] - A[0])
else:
    print(0)

Solution (Python):



def main():
    """Function."""
    n = int(input())
    a = list(map(int, input().split()))

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


if __name__ == "__main__":
    main()