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

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

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

s = min(a)
l = max(a)
print(l - 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 = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 0
for i in range(1, N):
    ans += A[i] - A[i-1]
print(ans)

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

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

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

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

Solution (Python):
"""
author : halo2halo
date : 30, Jan, 2020
"""

import sys
import itertools



read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
n = readline().rstrip()
a = sorted(map(int,readline().split()))
print(a[-1] - a[0])

Solution (Python):

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(input())
a = list(map(int,input().split()))
a.sort()
print(a[-1]-a[0])

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

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

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

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

Solution (Python):

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    N = INT()
    A = LIST()
    print(max(A) - min(A))

if __name__ == "__main__":
    main()

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    a=LIST()
    a=sorted(a)
    print(a[-1]-a[0])
if __name__ == '__main__':
    do()

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

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

Solution (Python):







def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

N = intinput()
a = listintinput()
print(max(a)-min(a))

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

Solution (Python):
x = input()

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

print(max(lists) - min(lists))

Solution (Python):
n = int(input())
a = [int(i) for i in 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):
import sys
input = sys.stdin.readline
N = int(input())
a = [int(i) for i in input().split()]
a.sort()
print(a[-1] - a[0])

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

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

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

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

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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = LIST()

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

sorted = sorted(a)

sum = 0
prev = -1
for p in sorted:
    if prev >= 0:
        sum += p - prev

    prev = p

print(sum)

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


import numpy as np
import fractions as fra


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

Solution (Python):


import numpy as np
import fractions as fra


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

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

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

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

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

Solution (Python):
n = int(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())
s = list(map(int, input().split()))
ans=max(s)-min(s)
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()))
sa=sorted(a)
total=0
for i in range(1,n):
    total += sa[i]-sa[i-1]

print(total)

Solution (Python):
n=int(input())
a=sorted([int(i) for i in input().split()])
b=[]
for i in range(n-1):
  b.append(a[i+1]-a[i])
print(sum(b))

Solution (Python):
import numpy as np

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

A = np.array(list(A))
A = np.sort(A)
ans = np.diff(A, n=1) 

print(sum(ans))

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

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

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

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

max_a = max(a)
min_a = min(a)

print(max_a - min_a)

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

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

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

A.sort()

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

Solution (Python):

 
import math
import itertools
import sys
import copy
 


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

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

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

maior = max(i)
menor = min(i)

print(maior-menor)

Solution (Python):
Nc = input()
N = int(Nc)
c = map(int,input().split())
l = list(c)
maiorP = l[0]
menorP = l[0]


for num in l:
    if 1 <= N <= 100 and 0 <= len(l) <= 100 and type(num) == int:
        if num > maiorP:
            maiorP = num
        if num < menorP:
            menorP = num
print(maiorP - menorP)

Solution (Python):
Nc = input()
N = int(Nc)
c = map(int,input().split())
l = list(c)
maiorP = l[0]
menorP = l[0]


for num in l:
    if 1 <= N <= 100 and 0 <= len(l) <= 100 and type(num) == int:
        if num > maiorP:
            maiorP = num
        if num < menorP:
            menorP = num
print(maiorP - menorP)

Solution (Python):
n = input()

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

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

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

print(max(h)-min(h))

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

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

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

Solution (Python):
import sys

n, *c = map(int, sys.stdin.read().split())

def main():
    c.sort()
    return c[-1] - c[0]

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    input()
    aa=LI()
    print(max(aa)-min(aa))
main()

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

print(max(al) - min(al))

Solution (Python):
import math

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

Solution (Python):
import sys
n = int(input())
l = list(map(int, sys.stdin.readline().split()))

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

Solution (Python):
import math

n = int(input())
l = sorted([int(i) for i in 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.sort()
print(a[-1]-a[0])

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

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
mod = 10**9+7
ans = 0 ;count = 0 ;pro = 1

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

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

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

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

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

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

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

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

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

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

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

New_A = sorted(a)

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

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

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

print(s[len(s)-1] - s[0])

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

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

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

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

print(max(ls_a) - min(ls_a))

Solution (Python):
n=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(reverse=True)
ans=0
before=a[0]
for i in a[1:]:
    ans+=before-i
    before=i
print(ans)

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

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

print(max(lst) - min(lst))

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

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

print(distance)

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())
P = [0]*N
p = input().split()
L = 0
for i in range(N):
  P[i] = int(p[i])
print(max(P)-min(P))

Solution (Python):


import numpy as np

N=int(input())
A=list(map(int,input().split(" ")))
Sa=np.asarray(sorted(A))
print((Sa[1:]-Sa[:-1]).sum())

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

Solution (Python):

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

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

home = []

home = input().split()

for i in range(0,N) :
    home[i] = int(home[i])

print(max(home) - min(home))

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

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))

li.sort()

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
def examB():
    N = I()
    a = LI(); a.sort()
    ans = a[-1]-a[0]
    print(ans)


import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

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

a_list = sorted(a_list)

answer = 0

for i in range(n-1):
  answer += a_list[i+1] - a_list[i]

print(answer)

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

print(aa[-1]-aa[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 = [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):
num = int(input())
house = list(map(int, input().split(' ')))

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

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

Solution (Python):
A = int(input())
B = list(map(int,input().split()))
max_ = B[0]
min_ = B[0]
for a in range(A):
  max_ = max(max_, B[a])
  min_ = min(min_, B[a])
print(max_- min_)

Solution (Python):
aa = input()
arr = list(map(int,input().split(" ")))
mx=arr[0]
mn=arr[0]
for aaa in arr:
  if(mx<aaa):
    mx=aaa
  elif(mn>aaa):
    mn=aaa

print(mx-mn)

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

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
a.sort()
print(a[-1]-a[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()))

a.sort()

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

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

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

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
res = float("inf")
a.sort()
for i in range(N):
  t = 0
  p = a[i]
  for j in range(N):
    t += abs(p - a[j])
    p = a[j]
  res = min(res, t)
print(res)

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

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

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

Solution (Python):
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    A = string_to_int(inputs[0])
    A.sort()
    return A[-1] - A[0]


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
mi,ma = 100000,0
for i in a:
	mi = min(mi,i)
	ma = max(ma,i)
print(ma-mi)

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

ans = 0
pos = Data.pop(0)
for d in Data:
    ans += (d - pos)
    pos = d
print(ans)

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

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

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

Solution (Python):
def main(n, a):
    min_, max_ = min(a), max(a)

    print(max_ - min_)


if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split(' ')))

    main(n, a)

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

si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

N = ni()
A = nl()

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

counter = 0

for i, j in zip(target, target[1:]):
  counter += j-i
  
print(counter)

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

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

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

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

min = a[0]
max = a[-1]
print (max - min)

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

Solution (Python):
n = int(input())
list_a = list(map(int, input().split()))
print(max(list_a) - min(list_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(e) for e in input().split()]

print(max(a_list)-min(a_list))

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

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

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

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

Solution (Python):
from sys import exit, stdin
N = int(stdin.readline().rstrip())
A = sorted([int(_) for _ in stdin.readline().rstrip().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())
di=list(map(int,input().split()))
di.sort()

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

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

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

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

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 slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    a.sort()
    print(abs(a[0] - a[-1]))


if __name__ == '__main__':
    slove()

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

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

print(d)

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()))
A = set(a)
A1 = sorted(A)
count = 0
for i in range(len(A)-1) :
    count += A1[i+1]-A1[i]

print(count)

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

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

Solution (Python):


def resolve():
  n = int(input())
  a = list(map(int, input().split()))
  a.sort()
  ans = 0
  prev = a[0]
  for v in a:
    ans += (v - prev)
    prev = v

  print(ans)
  return

if __name__ == "__main__":
    resolve()

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