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):
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(0 if n==1 else 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 os

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

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

maxCoordinate, minCoordinate = 0, 1000
for i in range(homeNum):
  if maxCoordinate < coordinate[i]:
    maxCoordinate = coordinate[i]
  if minCoordinate > coordinate[i]:
    minCoordinate = coordinate[i]

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

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

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

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()]
a.sort()
b = [abs(a[i]-a[i+1]) for i in range(n-1)]
print(sum(b))

Solution (Python):

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

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

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

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

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

M = max(a_list)
m = min(a_list)

print(M - m)

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

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

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

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

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

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

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

Solution (Python):
N = int(input())
A = sorted(list(map(int,input().split())))
print(sum([A[i+1] - A[i] for i in range(N-1)]))

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

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

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

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

Solution (Python):
from sys import stdin
n = int(stdin.readline().rstrip())

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


MIN = min(l)
MAX = max(l)

print(MAX - MIN)

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

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

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


def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
A = ILI()
print(max(A)-min(A))

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

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

a.sort()

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

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

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

Solution (Python):
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):
import sys
import copy
import  math
import bisect
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
li = sorted(na())
print(li[-1] - li[0])

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

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

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

d = 0
for i in range(1,N):
    D = abs(a[i] - a[i-1])
    d += D

print(d)

Solution (Python):
n = int(input())
position_list = [int(num) for num in input().split()]

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

Solution (Python):

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

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

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

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

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

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


if __name__ == "__main__":
    test()

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

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

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

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

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

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

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

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

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

Solution (Python):
def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    A.sort()
    return max(A) - min(A)


if __name__ == '__main__':
    print(main())

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

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

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

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

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

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

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

print(max(r)-min(r))

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

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

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

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

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

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

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

Solution (Python):
n=int(input())
a=sorted([int(i) for i in input().split()])
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())
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,*a=map(int,open(0).read().split())
print(max(a)-min(a))

Solution (Python):
input()
nums = [int(tok) for tok in input().split()]

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

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

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

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

Solution (Python):



def main():
    
    N = int(input())
    positionSet = set(map(int,input().split()))
    strPositionSet = sorted(positionSet)

    print(sum(j-i for i,j in zip(strPositionSet,strPositionSet[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 = [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 = sorted(list(map(int, input().split())))
print(abs(a[-1] - a[0]))

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

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

a.sort(reverse=True)
x = 0
for i in range(N-1):
  x +=(a[i]-a[i+1])

print(x)

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

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

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

print(max(house)-min(house))

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

print (sum([a[i+1] - a[i] for i in range(len(a)-1)]))

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

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

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

a.sort()

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

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

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

Solution (Python):

import sys
INF = float("inf")


def solve(N: int, a: "List[int]"):
    print(max(a)-min(a))
    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(max(a)-min(a))

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

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

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

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

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

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

Solution (Python):

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

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

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

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

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

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

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

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

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

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

aLst.sort()

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

Solution (Python):

n = int(input())
A = sorted([int(el) for el in input().split(' ')])
print(max(A)-min(A))

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

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

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

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

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
import random
 




 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    A = inputList()
    
    A.sort()
    
    print(A[-1] - A[0])
    
        
if __name__ == "__main__":
	main()

Solution (Python):

import sys, math, fractions, itertools


def solve(N: int, a: "List[int]"):
    a = sorted(a)
    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())
l = list(map(int, input().split()))
s = set(l)
print(max(s) - min(s))

Solution (Python):
n = int(input())
li = sorted(list(map(int, input().split())),reverse = True)
ans = []
for i in range(n-1):
    ans.append(li[i] - li[i+1])
print(sum(ans))

Solution (Python):
n = int(input())
ls = sorted(list(map(int, input().split())))
ans = 0
for i in range(n-1):
    ans += ls[i+1] - ls[i]
print(ans)

Solution (Python):
n = int(input())
ls = sorted(set(map(int, input().split())))
ans = 0
for i in range(len(ls)-1):
    ans += ls[i+1] - ls[i]
print(ans)

Solution (Python):


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

Solution (Python):
n=int(input())
house=input().split()
print(int(max(house))-int(min(house)))

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):
import numpy as np

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

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

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

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()))
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 defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    _, b, c = LS()
    x = int(b[0] + c[0]) % 4
    if not x:
        print("YES")
    else:
        print("NO")
    return


def B():
    n = II()
    a = LI()
    a.sort()
    print(a[-1]-a[0])
    return


def C():
    return


def D():
    return


if __name__ == '__main__':
    B()

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

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

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

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


def main(N, A):
    A = sorted(set(A))
    print(max(A)-min(A))
    
if __name__ == '__main__':
    N = int(input())
    A = [int(a) for a in input().split()]
    
    main(N, 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(x) for x in input().split()]

a = list(set(a))
a.sort()
print(sum([a[i+1] - a[i] for i in range(len(a) - 1)]))

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


main()

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

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

a.sort()
ans=max(a)-min(a)
print(ans)

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

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

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()))
a.sort()
ans = 0
for i in range(n-1):
    ans += a[i+1] - a[i]
print(ans)

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

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

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

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

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

print(sum([distinct_A[i] - distinct_A[i-1] for i in range(1, len(distinct_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()]
a.sort()
print(a[n-1]-a[0])

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

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

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

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

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

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

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

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

L.sort()
anser = L[input1-1] - L[0]


print(anser)

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

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

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

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):
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N = n()
A = nl()

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

a = sorted(a)

for i in range(1,N):
    ans.append(abs(a[i-1] - a[i]))

print(sum(ans))

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

Solution (Python):
N = int(input())
*A, = map(int, input().split())
A = sorted(A)
print(sum([A[i]-A[i-1] for i in range(1, N)]))

Solution (Python):

import sys
sys.setrecursionlimit(300000)


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


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    a = [ int(next(tokens)) for _ in range(N) ]  
    solve(N, a)

if __name__ == '__main__':
    main()

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

answer = max(arr)-min(arr)
print(answer)

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

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

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


abc()

Solution (Python):
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n = II()
a = LI()
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()

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