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-----
4
2 3 7 9

-----Sample Output-----
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.

Difficulty: EASY

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


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


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


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


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


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


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


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


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


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


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


N = int(input())
a = [int(v) for v in input().split(' ')]
max_v = max(a)
min_v = min(a)
print(max_v - min_v)


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


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


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


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


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


N = int(input())
my_list = list(map(int, input().split(maxsplit=N)))
my_list_sort = sorted(my_list)
answer = my_list_sort[-1] - my_list_sort[0]
print(answer)


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


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


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


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


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


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


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


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

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


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


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


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


N = int(input())
A = [int(x) for x in input().split()]
print(max(A) - min(A))


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


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


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


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


S_list = [input() for i in range(2)]
N = map(int, S_list[0].split())
A_list = list(map(int, S_list[1].split()))
print(max(A_list) - min(A_list))


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


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


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


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


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


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


(_, *a) = map(int, open(0).read().split())
print(max(a) - min(a))


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


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


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


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


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


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


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


N = int(input())
S = map(int, input().split())
Number = list(S)
Number.sort(reverse=True)
total_distance = []
for i in range(1, N):
	distance = Number[0] - Number[1]
	total_distance.append(distance)
	del Number[0]
print(sum(total_distance))


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


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


def minimum_dist(l1: list) -> int:
	return max(l1) - min(l1)

def __starting_point():
	n = int(input())
	list_coordinate = list(map(int, input().split()))
	print(minimum_dist(list_coordinate))
__starting_point()


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


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


input()
a = sorted([int(i) for i in input().split()])
print(a[-1] - a[0])


(n, *a) = map(int, open(0).read().split())
a.sort()
print(a[-1] - a[0])


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


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


N = int(input())
a = str(input())

def ans064(N: int, a: str):
	a_list = sorted(map(int, a.split()))
	return a_list[-1] - a_list[0]
print(ans064(N, a))


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


input()
p = sorted([int(x) for x in input().split(' ')])
print(p[-1] - p[0])


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


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


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


n = input()
num = [int(i) for i in input().split()]
print(max(num) - min(num))


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


with open(0) as f:
	(N, *a) = map(int, f.read().split())
print(max(a) - min(a))


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


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


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


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


N = int(input())
lst = input().split()
for i in range(N):
	lst[i] = int(lst[i])
print(max(lst) - min(lst))


N = int(input())
a = list(map(int, input().split()))
a.sort()
distance = 0
for i in range(N - 1):
	distance += a[i + 1] - a[i]
print(distance)


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


N = int(input())
a = [int(x) for x in input().split()]
print(max(a) - min(a))


(_, *aa) = map(int, open(0).read().split())
print(max(aa) - min(aa))


N = int(input())
A = list(map(int, input().split()))
A.sort()
print(A[-1] - A[0] if N > 1 else 0)


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


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


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


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


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


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


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


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


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


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


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


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


home_num = int(input())
house_from = list(map(int, input().split()))
print(max(set(house_from)) - min(set(house_from)))


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


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


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


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


_ = input()
A = sorted((int(T) for T in input().split()))
print(A[-1] - A[0])


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


N = input()
n = [int(i) for i in input().split()]
print(max(n) - min(n))


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


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


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


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


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


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


from sys import stdin
rs = lambda : stdin.readline().strip()
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))

def main():
	N = ri()
	a = ril()
	print(max(a) - min(a))

def __starting_point():
	main()
__starting_point()


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


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


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


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


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


input()
l = [int(x) for x in input().split()]
print(max(l) - min(l))


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


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


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


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


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


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


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


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


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


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


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


(N, *A) = map(int, open(0).read().split())
A.sort()
print(A[-1] - A[0])


def abc064b(n: int, a_list: int) -> int:
	return max(a_list) - min(a_list)
n = int(input())
a_list = list(map(int, input().split()))
print(abc064b(n, a_list))


n = int(input())
a = [int(s) for s in input().split()]
print(max(a) - min(a))


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
print(l[-1] - l[0])


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


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


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


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


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


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


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


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


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


def atc_064b(input_value: str) -> str:
	N = input_value[0]
	ai = [int(i) for i in input_value[1].split(' ')]
	return max(ai) - min(ai)
N = input()
ai = input()
print(atc_064b([N, ai]))


def main():
	N = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	for i in range(1, N, 1):
		ans += a[i] - a[i - 1]
	return ans
print(main())


homecnt = int(input())
homeplace = list(map(int, input().split()))
dist = max(homeplace) - min(homeplace)
print(dist)


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


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


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


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


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


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


input()
l = [int(i) for i in input().split()]
print(max(l) - min(l))


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


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


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


import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
A.sort()
print(A[N - 1] - A[0])


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


(_, t) = open(0)
(*a,) = map(int, t.split())
print(max(a) - min(a))


input()
a = [int(_) for _ in input().split()]
a.sort()
print(a[-1] - a[0])


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


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


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


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


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


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


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