Problem:
 Score : 200 points    Problem Statement It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts. There are N houses along TopCoDeer street . The i -th house is located at coordinate a_i . He has decided to deliver gifts to all these houses. Find the minimum distance to be traveled when AtCoDeer can start and end his travel at any positions.      Constraints  1 ≤ N ≤ 100  0 ≤ a_i ≤ 1000  a_i is an integer.         Input Input is given from Standard Input in the following format:  N  a_1  a_2  ...  a_N       Output Print the minimum distance to be traveled.        Sample Input 1 4
2 3 7 9      Sample Output 1 7  The travel distance of 7 can be achieved by starting at coordinate 9 and traveling straight to coordinate 2 . It is not possible to do with a travel distance of less than 7 , and thus 7 is the minimum distance to be traveled.       Sample Input 2 8
3 1 4 1 5 9 2 6      Sample Output 2 8  There may be more than one house at a position.

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


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

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

n_max = max(array)
n_min = min(array)

ans = n_max - n_min
print(ans)

Solution (Python):
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    print(max(A)-min(A))


if __name__ == '__main__':
    main()

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

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

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

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

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

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

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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

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):
a,s=open(0);k=sorted(s.split());print(eval(k[-1]+"-"+k[0]))

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

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

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

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

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

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

Solution (Python):

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
input()
lis=list(map(int,input().split()))
lis.sort()
dist=0
begin=lis[0]
for a in lis:
    dist+=a-begin
    begin=a
print(dist)

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

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

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

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

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

MAX_position = max(houseposition)
min_position = min(houseposition)
print(MAX_position - min_position)

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

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

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

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

Solution (Python):

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

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

Solution (Python):
N=input()
mylist=input().split()
print(int(max(mylist))-int(min(mylist)))

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

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

A = sorted(A)
con = 0

for i in range(N-1):
    con += A[i+1] - A[i]

print(con)

Solution (Python):
def nexthouse(house, cur, delivered):
    dmin = 10**5
    nxt = 0

    for i in range(len(house)):
        if delivered[i] != True:
            if abs( house[cur] - house[i] ) < dmin :
                dmin = abs( house[cur] - house[i] )
                nxt = i
    delivered[nxt] = True
    return nxt

def main():
    N = int(input())
    house = [int(a) for a in input().split()]
    dlist = [None]*N
    
    for i in range(N):
        dm = 10**5
        dtotal = 0
        cur = i
        deliv = [0]*N
        deliv[cur] = True
        
        while deliv.count(0) > 0:
            nxt = nexthouse(house, cur, deliv)
            dtotal += abs(house[nxt] - house[cur])
            cur = nxt

        dlist[i] = dtotal

    print(min(dlist))
main()

Solution (Python):

n = int(input())
a = [int(s) for s in 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(max(a)-min(a))

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

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

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

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

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

array.sort()

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

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

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

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

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

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

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

Solution (Python):
_, *l = map(int, open(0).read().split())
print(max(l)-min(l))

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()))
 
b=sorted(b)
sum=0
 
for i in range(1,a):
    sum+=b[i]-b[i-1]
 
print(sum)

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

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

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

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

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

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

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

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

d = max(a_list) - min(a_list)

print(d)

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




"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""








def main():
  n = int(input())
  a = list(map(int,input().split()))
  a = sorted(a,reverse=True)
  print(a[0] - a[n-1])
  
  
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()))
print(max(a)-min(a))

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

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

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

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

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

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
n = ii()
A = set(sorted(iil()))
print(max(A)-min(A))

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

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

t.sort()

ans = 0

for i in range(1,n):
    ans += t[i]-t[i-1]
print(ans)

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

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

a=sorted(a)
sum=0

for i in range(1,N):
    sum+=a[i]-a[i-1]

print(sum)

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

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

print(max(house_list)-min(house_list))

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

Solution (Python):
import math

input()

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

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

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

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

Solution (Python):
N = 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(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()))
a.sort()
print(a[-1]-a[0])

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

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

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

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

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

Solution (Python):

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

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

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

Solution (Python):

import math
import itertools
import statistics

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

Solution (Python):


import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n = ni()
a = na()

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

print(max(houses)-min(houses))

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
import itertools


from operator import itemgetter
from sys import stdin


N=3
M=3
i=0
j=0
k=0



N=int(input())
dis_list=[]
housepos_list=list(map(int, input().split(" ")))

housepos_list=sorted(housepos_list)
for i in range(N-1):
    dis_list.append(housepos_list[i]-housepos_list[i+1])
print(abs(sum(dis_list)))



"1行1つの整数を入力を取得し、整数と取得する"




"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

for i in number_list:
    print(number_list[i-1])

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''



"正方行列にstr型の値を入力"
'''




'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"


'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''











'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''




"aという変数に入っているものを大文字にして出力"

Solution (Python):
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):

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

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

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

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

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

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

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

list.sort()

print(list[num-1]-list[0])

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

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

Solution (Python):
import sys
import math










mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

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

if __name__=='__main__':
    main()

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

A = list(set(a))
A.sort()

ans = 0
for i in range(1,len(A)):
    ans += A[i] - A[i-1]

print(ans)

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

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

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

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

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

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
for i in range(len(a)-1):
  ans += a[i]-a[i+1]
print(ans)

Solution (Python):

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

Solution (Python):

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

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

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

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

Solution (Python):








def resolve():
    N=int(input())
    A=sorted(list(map(int,input().split())))

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




resolve()

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

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

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

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

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

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

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

a_L = sorted(a_L)

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

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

Solution (Python):
n=int(input())
aa=list(map(int,input().split()))
aa.sort()
d=0
for i in range(1,len(aa)):
  d+=abs(aa[i]-aa[i-1])
print(d)

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())
mina = 1000
maxa = 0
A = list(map(int,input().split()))
for i in range(n):
  mina = min(mina,A[i])
  maxa = max(maxa,A[i])
print(maxa - mina)

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

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

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

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


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

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

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

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

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

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

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    a=LI()
    print(max(a)-min(a))

main()

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

print(max(S) - min(S))

Solution (Python):
N = int(input().strip())
a_list = list(map(int, input().rstrip().split()))

a_list.sort()

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

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

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

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

Solution (Python):

n=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 = [int(_) for _ 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):
def main():
    N = input()
    a = list(map(int, input().split()))
    print(max(a) - min(a))

if __name__ == '__main__':
    main()

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

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

Solution (Python):


house_count = int(input().rstrip())
house_list = sorted(map(int, input().rstrip().split(" ")))
ans = house_list[house_count-1] - house_list[0]
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())
l=sorted(map(int,input().split()))
print(l[-1]-l[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 = 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):
def main():
    house_num = int(input())
    houses = sorted(set(list(map(int, input().split()))))
    print(houses[-1] - houses[0])


if __name__ == '__main__':
    main()

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

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

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

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())
L=list(map(int,input().split()))
M=sorted(list(set(L)))
ans=0
for i in range (len(M)-1):
  ans+=M[i+1]-M[i]
print(ans)

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

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

print(max(lst1)-min(lst1))

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

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

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

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

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

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

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

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

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

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

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

ans = 0
for i in range(1, len(a)):
  ans += a[i] - a[i-1]
print(ans)

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

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

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

a.sort()

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

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

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

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

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

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

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

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

Solution (Python):
def christmas(s , a):

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

def main():
    s = int(input())
    a = list(map(int , input().split()))
    print(christmas(s , a))

if __name__ == '__main__':
    main()

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

Solution (Python):




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


if __name__ == "__main__":
    main()

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

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

Solution (Python):
n = int(input())
str = input().split()
a_i = []
for x in range(n):
    a_i.append(int(str[x]))
a_i.sort()
print(a_i[n - 1] - a_i[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 = sorted(list(map(int,input().split())))
print(a[n-1]-a[0])

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

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

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

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

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

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

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

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

ans = 0

for a_i in range(1, len(A)):
  ans += A[a_i]-A[a_i-1]
  
print(ans)