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 solve():
    N = int(input())
    A = list(map(int, input().split(" ")))
    houses = []
    for a in A:
        if not a in houses:
            houses.append(a)
        else:
            pass

    houses.sort()
    ans = 0
    for i in range(len(houses) - 1):
        ans += houses[i + 1] - houses[i]

    print(ans)


solve()

Solution (Python):
n = int(input())
pos = list(map(int, input().split()))
dis = 0
pos.sort()
for i in range(n):
  if not i == n - 1:
    dis += pos[i + 1] - pos[i]
print(dis)

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

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

len.sort()

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

Solution (Python):


a=[]
N=int(input())
for i in input().split():
    a.append(int(i))

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):

"""
http://abc064.contest.atcoder.jp/tasks/abc064_b

"""
import sys
from sys import stdin

input = stdin.readline


def main(args):
    N = int(input())
    positions = [int(x) for x in input().split()]
    print(max(positions) - min(positions))


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
_ = 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 = 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()]
print(max(a)-min(a))

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

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

min = min(A)
max = max(A)

print(max-min)

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

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


if __name__ == "__main__":
    main()

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

print(max(a_n)-min(a_n))

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

Solution (Python):
n=int(input())
MIN=1000
MAX=0
a=list(map(int,input().split()))
for i in range(n):
    if  MIN>a[i]:
        MIN=a[i]
    if MAX<a[i]:
        MAX=a[i]
print(MAX-MIN)

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

Solution (Python):



import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)



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

a.sort()
ans = a[n-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):



import sys
from collections import deque

n = int(sys.stdin.readline())
ai = list(map(int, sys.stdin.readline().split()))

min = float('inf')
max = 0

for a in ai:
	if a < min:
		min = a

	if a > max:
		max = a

print(str(int(max - min)))

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

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

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

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

i = max(m)
j = min(m)

print( i - j )

Solution (Python):

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

Solution (Python):
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input())
def pli(a): return "".join(list(map(str, a)))

N = ri()
s = rli()
print(max(s)-min(s))

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

Solution (Python):
nums = [0]
n = int(input())
nums *= n
nums = list(map(int,input().split()))
max = 0
min = 1000
for i in range(n):
    if nums[i]<min:
        min = nums[i]
    if max<nums[i]:
        max = nums[i]
print(max-min)

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

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

Solution (Python):

def main():
	N = int(input())
	houses = list(map(int, input().split()))
	print(max(houses) - min(houses))
	
if __name__ == '__main__':
	main()

Solution (Python):
from collections import defaultdict


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


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

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

Solution (Python):
input_line_1 = raw_input()
input_line_2 = raw_input()

array = [int(i) for i in input_line_2.split(" ")]
print max(array) - min(array)

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

print ("%d"%(max(a) - min(a)))

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

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()))
A.sort()
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):
import numpy as np

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

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

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

Solution (Python):
import sys

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

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

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

Solution (Python):
_ = input()
a = [int(s) for s in input().split()]

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

Solution (Python):


import sys
import subprocess
import json
import time
import math
import re
import sqlite3

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

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

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

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

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

Solution (Python):

def solve():
    N = input()
    a = input().split()
    a.sort()
    n = 0
    for i in range (0, len(a) - 1):
        n += int(a[i+1]) - int(a[i])
    print(n)


if __name__ == '__main__':
    solve()

Solution (Python):
def get_min_root_num(a):
    max_a = 0
    min_a = 1000
    for buf_a in a:
        if buf_a > max_a:
            max_a = buf_a

        if buf_a < min_a:
            min_a = buf_a

    return max_a-min_a

if __name__ == '__main__':
    N = input()
    a_list = [int(i) for i in input().split()]

    print(get_min_root_num(a_list))

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

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

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

print(max(coords) - min(coords))

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

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

import numpy as np
a = raw_input().split()

for i in range(n):
	a[i] = int(a[i])
	i = i+1
	
dis = np.max(a) - np.min(a)
print dis

Solution (Python):
n=input()
n=int(n)
import numpy as np
a=input().split()
for i in range(n):
 a[i]=int(a[i])
dis=np.max(a)-np.min(a)
print(dis)

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

Solution (Python):
n=int(input())
nums=input().split()

ma=max(nums)
mi=min(nums)
print(int(ma)-int(mi))

Solution (Python):
number = int(input())
coords = [int(i) for i in input().split()]
distance = max(coords) - min(coords)

print(distance)

Solution (Python):

 
x = int(input())

 
y = input().split()

 
for i in range(x):
    y[i] = int(y[i])
 
Max = max(y)
Min = min(y)
 
ans = Max - Min
 
print(ans)

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

Solution (Python):
N = input()
a = []
a.append(map(int, raw_input().split()))

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

Solution (Python):


import sys
import math

N, = map(int, sys.stdin.readline().rstrip().split())
a_list = list(map(int, sys.stdin.readline().rstrip().split()))

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


exit(0)

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

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

Solution (Python):
input()
l = input()
a = [int(i) for i in l.split()]

x = max(a)
n = min(a)

print(x-n)

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

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

Solution (Python):
N=input()
max = -1
min=1001
for num in [int(n) for n in raw_input().split(' ')]:
	if max < num:
		max=num
	if min > num:
		min=num

print(max-min)

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

Solution (Python):

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


a_max = max(a)
a_min = min(a)
ans = a_max - a_min
print(ans)

Solution (Python):
n = input()
houses = map(lambda x: int(x), raw_input().split())
houses = sorted(list(set(houses)))
print houses[-1] - houses[0]

Solution (Python):


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

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

Solution (Python):
num = int(raw_input())
law = raw_input().split(" ")
tmp = 0
raw = []
for i in law:
    raw.append(int(i))
for i in range(num):
    for j in range(i, num):
        div = abs(raw[i] - raw[j])
        if div >= tmp:
            tmp = div
print tmp

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


a = input().split()
a.sort()

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

Solution (Python):


N = int(input())

M = input().split()
M.sort()

a = int(M[N-1]) - int(M[0])

print(a)

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

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

print(max(Ai)-min(Ai))

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

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

l_max = max(l)
l_min = min(l)

print(str(l_max - l_min))

Solution (Python):
def f(A):
    return max(A) - min(A)

N = int(input())
A = list(map(int, input().split()))
print(f(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(raw_input())
homes = map(int, raw_input().split(' '))
mindist = min(homes)
maxdist = max(homes)
print maxdist - mindist

Solution (Python):


n = int(input())
a = input().split()

for i in range(n):
	a[i] = int(a[i])

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

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

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

Solution (Python):
"""
AtCoder Beginner Contest 064
B - Traveling AtCoDeer Problem
@author haru
"""

arg1 = input()
arg2 = input()
if not arg2.replace(" ","").isdigit(): exit("Error: Invalid Input")
DIMENTION = int(arg1) if arg1.isdigit() else exit("Error: Invalid Input")
POSITIONS = [int(a) for a in arg2.split(" ")]
if not DIMENTION == len(POSITIONS): exit("Error: Invalid Input")
print(max(POSITIONS) - min(POSITIONS))

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

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

Solution (Python):

import sys

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

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

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

Solution (Python):
import sys


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

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

a=input()
a=a.split()
for i in range(N):
    a[i]=int(a[i])

a=sorted(a)

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

Solution (Python):
def read(): return list(map(int, input().split()))


n = int(input())
a = read()
print(max(a) - min(a))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
max = -1
min = 1001
for i in range(N):
    if a[i]>max:
        max = a[i]
for i in range(N):
    if a[i]<min:
        min = a[i]
print(max-min)

Solution (Python):
if __name__=="__main__":
    N = int(raw_input())
    a = list(set(map(int, raw_input().split())))
    a.sort()
    ans = sum([x[1]-x[0] for x in zip(a, a[1:])])
    print ans

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

Solution (Python):



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

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 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 I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    N = I()
    a = LI()
    return max(a) - min(a)


print(main())

Solution (Python):
tmp = input()
zahyo = [int(n) for n in input().split(" ")]
print(max(zahyo) - min(zahyo))

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

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

output = int(max(data)) - int(min(data))
print(output)

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

Solution (Python):
input(); print((lambda xs: max(xs) - min(xs))([int(x) for x in input().split()]))

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

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

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

Solution (Python):
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()


n = ni()
a = na()

a = sorted(a)

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

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

maxX=max(x)
minX=min(x)
print(int(maxX)-int(minX))

Solution (Python):
from sys import stdin
n = int(stdin.readline())
a = map(int,stdin.readline().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=[int(i) for i in input(). split ()]
mi=a[0]
ma=a[0]
i=0
while i<N:
    if a[i]>ma:
        ma=a[i]
    if a[i]<mi:
        mi=a[i]
    i+=1
print (ma-mi)

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

Solution (Python):

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

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

ma = -1
mi = 100100100100
for i in range(n):
    ma = max(ma, a[i])
    mi = min(mi, a[i])

print (ma - mi)

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

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

Solution (Python):


import sys
import os

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

left = min(a)
right = max(a)

print(right - left)

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=raw_input()
a=raw_input().split()
a=map(int,a)
import numpy as np
ans=np.abs(np.max(a)-np.min(a))
print(ans)

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

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

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

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

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

Solution (Python):
import copy
N = int(input())
a = map(int, input().split())
b = copy.deepcopy(a)
print(max(b) - min(a))

Solution (Python):
N = int(input())
a = input().split()
min = 1000
max = 0
for jj in range(len(a)):
    if (int(a[jj]) < min):
       min = int(a[jj])
    if (int(a[jj]) > max):
      max = int(a[jj])
print(max - min)

Solution (Python):

N=int(raw_input().strip())
a=map(int,raw_input().split())
print max(a)-min(a)

Solution (Python):


N = int(raw_input())
a = map(int, raw_input().split()) 

print max(a) - min(a)

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

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

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

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

house.sort()

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

Solution (Python):

"""
Created on Sun Aug 28 21:42:33 2016

@author: you
"""

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

Solution (Python):
n = int(input())
a = list(int(i) for i in input().split())



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

Solution (Python):
n = int(input())
a = list(int(i) for i in input().split())

a.sort

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

Solution (Python):
N=int(input())
nums=input().split()
mx=int(max(nums))
mn=int(min(nums))
ans=mx-mn
print(ans)

Solution (Python):
n = input()
a = input()
tmp_a = a.split()
a_list = []

for i in range(int(n)):
    a_list.append(int(tmp_a[i]))

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

Solution (Python):
a = input()
b = input().split()
b.sort()
ans = int(b[-1]) - int(b[0])
print(ans)

Solution (Python):
houseTime = int(input())
place = input().split() 
place = [int(i) for i in place]
place = sorted(place)
print(place[houseTime - 1] - place[0])

Solution (Python):
N=input()
a_n=[]
a_n = input().split(" ")

a_n.sort()
d = int(a_n[-1]) - int(a_n[0])
print(d)

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

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

print('{0}'.format(max(x)-min(x)))



quit()

Solution (Python):


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

i=0
while i<N:
	
	i+=1


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

Solution (Python):
n = int(input())
a = input().split()
list =[]

for i in range(n):
    if a[i] not in list:
        list.append(a[i])
    else:
        pass
    
list.sort()

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

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

print max(a) - min(a)

Solution (Python):
def main():
    
    _ = int(input().strip())

    points = list(map(int, input().strip().split()))
    min_p = min(points)
    max_p = max(points)
    print(max_p - min_p)

if __name__ == '__main__':
    main()

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

Solution (Python):

import sys
import numpy as np
from math import *
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    house_list = []
    for i in range(N):
        house_list.append(int(input_raw[i]))

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

    print dist



if __name__ == '__main__':
    main()

Solution (Python):



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

Solution (Python):
import numpy as np
 
n = int(input())
a = list(int(i) for i in input().split()) 
a.sort()
b = a[n - 1] - a[0]

print (b)

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

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

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 = input()
L = input().split()

print(int(max(L))-int(min(L)))

Solution (Python):
import numpy as np

if __name__=="__main__":
    N = int(input())
    a = input().split()
    a = list(map(int, a))
    a = np.sort(a)
    s = 0
    for i in range(len(a) - 1):
        s += (a[i+1] - a[i])

    print(s)

Solution (Python):
def main():
    N = int(input())
    A = tuple(map(int, input().split()))

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

main()

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

Solution (Python):



def main():
    n = int(raw_input())
    xs = [int(x) for x in raw_input().split()]

    xs.sort()

    print xs[-1] - xs[0]


main()

Solution (Python):
w =  input()
a= input().split(' ')
a = [int(x) for x in a]
mi = min(a)
ma = max(a)
print(int(ma- mi))

Solution (Python):
N = input()
nums = [int(x) for x in input().split()]
nums.sort()
ans = nums[-1] - nums[0]
print(ans)

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

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

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

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

print(max(inps)-min(inps))

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

data = input().split()
data = data[:N]

print(int(max(data)) - int(min(data)))

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

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

max=-10
min=10000
for i in a:
    if i>max:
        max=i
    if i<min:
        min=i
print(max-min)

Solution (Python):

N = int(input())
a = list(reversed(sorted(list(set(list(map(int, input().split())))))))
ans = 0
for tmp in range(len(a)-1):
    ans += a[tmp] - a[tmp+1]
print(ans)

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

print max(a)-min(a)

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

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

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

print(str(b[N-1]-b[0]))

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

Solution (Python):
import sys

def main():
    n = int(sys.stdin.readline())

    max_a = -1
    min_a = 1001

    line = sys.stdin.readline()
    for ch in line.split():
        a = int(ch)
        if a > max_a:
            max_a = a
        if a < min_a:
            min_a = a

    print(max_a - min_a)
    return 0

if __name__ == '__main__':
    sys.exit(main())

Solution (Python):
N = int(input())
min = 1001
max = 0

addresses = inputs = list(map(int, input().split(" ")))
for address in addresses:
    if address < min:
        min = address
    if address > max:
        max = address

print(max - min)

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

print(max(a_list_num)-min(a_list_num))

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

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

print(M - m)

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

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

print max(A) - min(A)

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

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

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

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

a = sorted(a,reverse=True)

result = 0

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

print(result)

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

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

Solution (Python):


n = input()
a = map(int, raw_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 = [int(_) for _ in input().split()]

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

Solution (Python):

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

b()

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

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

Solution (Python):


if __name__ == "__main__":
    N = int(input())
    num_list = list(map(int, input().split(" ")))

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

Solution (Python):
if __name__ == '__main__':
    N = int(input())

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

    a.sort()

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

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

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

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

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

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

Solution (Python):

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

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

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

Solution (Python):

N = int(input())
ary = [int(e) for e in input().split()]

max_a = max(ary)
min_a = min(ary)

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 = set(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):
N=int(raw_input())
a=map(int,raw_input().split(' '))

print max(a)-min(a)

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

Solution (Python):

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

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

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

Solution (Python):
N = int(input())
mn = 1e9
mx = -1
ss = input().split()
for i in range(N) :
	t = int(ss[i])
	mn = min(mn, t)
	mx = max(mx, t)

print(mx-mn)