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.  



Sample input:
4
2 3 7 9


Sample output:
7

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
an= sorted(set([int(n) for n in input().split()]))
print(an[-1]-an[0])

Submission status: Accepted

Solution code:
N = int(input())
a_s = [ int(x) for x in input().split() ]

ans = max(a_s) - min(a_s)

print(ans)

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
""" AtCoder """

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
_ = input()
n = list(map(int, input().split()))
print(max(n) - min(n))

Submission status: Accepted

Solution code:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy

def j(q):
    if q==1: print("Heisei")
    else:print("TBD")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())


n = ip()                              #入力整数1つ
#n,k= (int(i) for i in input().split())      #入力整数横2つ
#n,x,y = (int(i) for i in input().split())    #入力整数横3つ
#n,a,b,c= (int(i) for i in input().split())  #入力整数横4つ
a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
print(max(a)-min(a))

Submission status: Accepted

Solution code:
n = int(input())
x = sorted(list(map(int, input().split())))

print(max(x)-min(x))

Submission status: Accepted

Solution code:
n = int(input())
aa = sorted(list(map(int, input().split())))

print(max(aa) - min(aa))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(a) for a in input().split()]
A = list(set(A))
A.sort()
print(max(A)-min(A))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def func():
    pass


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
A = [int(a) for a in input().split()]
A .sort()
B = [i-j for i,j in zip(A[1:],A[:-1])]
print(sum(B))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
A = sorted(int(i) for i in input().split())
print(A[-1] - A[0])

Submission status: Accepted

Solution code:
n = int(input())
house = list(map(int, input().split()))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 064
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]

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

Submission status: Accepted

Solution code:
n = int(input())
line = input().split(" ")
a = []

for i in range(n):
    a.append(int(line[i]))

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

Submission status: Accepted

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

Amax = max(A)
Amin = min(A)
print(Amax - Amin)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = sorted(list(int(i) for i in input().split()))
print(max(a)-min(a))

Submission status: Accepted

Solution code:
if __name__ == '__main__':

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split())) 
A = set(a)
B = sorted(A)
C = []
for i in range(len(A)-1):
    C.append(B[i+1]-B[i])
print(sum(C))

Submission status: Accepted

Solution code:
N = int(input())
A = [int(_) for _ in input().split()]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
print(max([max(a) - min(a) for a in [list(map(int, input().split()))]]))

Submission status: Accepted

Solution code:
int_n = int(input())
ar_int_a = list(map(int, input().split()))
print(max(ar_int_a) - min(ar_int_a))

Submission status: Accepted

Solution code:
a = int(input())
A = map(int, input().split())
B = []
for i in A:
    B.append(i)
print(max(B) - min(B))

Submission status: Accepted

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


abc064_b()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B Traveling AtCodeer
a = int(input())
x = list(map(int,input().split()))
x.sort()
print(x[a-1]-x[0])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
a_list=list(map(int,input().split()))
a_list.sort()
ans=0

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    _ = input()
    aa = sorted(map(int, input().split()))
    print(aa[-1] - aa[0])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
place = [int(i) for i in input().split()]
place.sort()
print(place[-1] - place[0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = sorted([ int(i) for i in input().split()])
l = 0
for i in range(1, len(a)):
    l += a[i]-a[i-1]
print(l)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
a=input().strip().split(" ")
a=[int(i) for i in a]
a.sort()

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

Submission status: Accepted

Solution code:
# coding: utf-8
_ = int(input())
lst = list(map(int, input().split()))
print(max(lst) - min(lst))

Submission status: Accepted

Solution code:
n = int(input())
a = input().split()
a = [int(m) for m in a]
print(max(a) - min(a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int,input().split()))
A.sort()
num=0
for i in range(1, len(A)):
  num += A[i] - A[i-1]

print(num)

Submission status: Accepted

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

Submission status: Accepted

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

a.sort()
p = a[0]
ans = 0

for i in a:
	if p == i:
		continue
	ans += i - p
	p = i
	
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input().rstrip())
a = list(map(int, input().rstrip().split()))
a.sort()
result = 0
if 1 < len(a):
    result = a[-1] - a[0]


print(result)

Submission status: Accepted

Solution code:
a = int(input())
count = 0
ar = list(map(int,input().split(" ")))
br = sorted(ar,reverse=True)
for i in range(a-1):
    count += br[i] - br[i+1]
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
size_number = input()
a = map(int, raw_input().split())
max = -1000
min = 99999
for i in range(size_number):
    if(max < a[i]):
        max = a[i]
    if(min > a[i]):
        min = a[i]
print(max - min)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
array = list(map(int, input().strip().split(' ')))
num = sorted(array)
ans = num[-1] - num[0]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(_) for _ in input().split()]

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n=int(input())
l = list(map(int, input().split()))
l.sort()
print(l[len(l)-1]-l[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
from sys import maxsize


def main() -> int:
    n = next_int()
    lowest = maxsize
    highest = 0

    for _ in range(n):
        ai = next_int()
        lowest = min(lowest, ai)
        highest = max(highest, ai)

    print(highest - lowest)
    return 0


def next_int() -> int:
    return int(next_str())


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
left = 1e9
right = -1
A = list(map(int, input().split()))
'''
A = [input() for i in range(n)]
for i in range(n) :
    A = list(map(int, input().split()))'''
for i in range(n) :
    left = min(A[i], left)
    right = max(A[i], right)
print(right - left)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
listA=list(map(int, input().split()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

a.sort(reverse = True)

#print(a)

ans = 0

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


print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a = list(li())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

max_num = max(a_list)
min_num = min(a_list)
print(max_num-min_num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3 -V
#-*- coding = utf-8 -*-
N = int(input())
a = list(map(int, input().split()))
mi = a[0]
ma = a[0]
for i in range(1,N):
    if a[i] < mi:
        mi = a[i]
    elif a[i] > ma:
        ma = a[i]
print(ma-mi)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


class Combination:
    def __init__(self, n, mod):

        g1 = [1, 1]
        g2 = [1, 1]
        inverse = [0, 1]
        for i in range(2, n + 1):
            g1.append((g1[-1] * i) % mod)
            inverse.append((-inverse[mod % i] * (mod // i)) % mod)
            g2.append((g2[-1] * inverse[-1]) % mod)
        self.MOD = mod
        self.N = n
        self.g1 = g1
        self.g2 = g2
        self.inverse = inverse

    def __call__(self, n, r):
        if (r < 0 or r > n):
            return 0
        r = min(r, n - r)
        return self.g1[n] * self.g2[r] * self.g2[n - r] % self.MOD


# --------------------------------------------

dp = None


def main():
    N = int(input())
    A = li_input()

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


main()

Submission status: Accepted

Solution code:
N = int(input())
a = [int(x) for x in input().split()]

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

Submission status: Accepted

Solution code:
N = int(input())
aList = list(map(int, input().split()))

print(max(aList) - min(aList))

Submission status: Accepted

Solution code:
# vim: set fileencoding=utf-8:


def main():
    N = input()
    a = [int(ele) for ele in raw_input().split()]
    a.sort()
    print(a[-1] - a[0])



if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#64b
n = int(input())
a = list(map(int,input().split()))
print(max(a)-min(a))

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    lists = list(map(int, input().split()))

    lists = sorted(lists)
    result = lists[-1] - lists[0]
    print(result)

solve()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0

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

print(ans)

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-

def main():
    n = int(input())
    a_list = list(map(int, input().split()))

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

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

print(max(aa)-min(aa))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = raw_input()
l = [int(x) for x in raw_input().split()]
print max(l) - min(l)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

Submission status: Accepted

Solution code:
"""
https://abc064.contest.atcoder.jp/tasks/abc064_b
"""
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
print(a[len(a)-1]-a[0])

Submission status: Accepted

Solution code:
N = int(input())
li = list(map(int,input().split()))
li.sort()
cnt = li[0]
ans = 0
for i in li:
    ans += abs(cnt - i)
    cnt = i

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
arr = map(int,raw_input().split())

print max(arr)-min(arr)

Submission status: Accepted

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

ans = max(A) - min(A)

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

aN.sort()

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

Submission status: Accepted

Solution code:
n=int(input())
code=input().split()
mi=1001
ma=0
for i in range(n):
    mi=min(mi,int(code[i]))
    ma=max(ma,int(code[i]))
print(ma-mi)

Submission status: Accepted

Solution code:
x=int(input())
A=[int(x) for x in str(input()).split()]

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

Submission status: Accepted

Solution code:
a=int(input())
list=input().split(" ")
for i in range (len(list)):
    list[i]=int(list[i])
print(max(list)-min(list))

Submission status: Accepted

Solution code:
n=int(input())
x=input().split()
y=0
while y<n:
    x[y]=int(x[y])
    y+=1
x.sort()
print(int(x[-1]-x[0]))

Submission status: Accepted

Solution code:
N = int(input())
input_list = [int(i) for i in input().split()]

print(max(input_list)-min(input_list))

Submission status: Accepted

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

nums = sorted(a)
print(nums[len(nums)-1] - nums[0])

Submission status: Accepted

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

if n == 1:
    print(0)
else:
    print(max(a) - min(a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
houses = list(map(int, input().split()))
houses.sort(reverse=True)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
print('{}'.format(max(a)-min(a)))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = raw_input()
norm = raw_input()
j = [int(i) for i in norm.split(" ")]

j.sort()
j.reverse()

dist = j[0] - j[-1]

print(dist)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a_s = sorted(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))[:N]

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

Submission status: Accepted

Solution code:
# coding: utf-8
loops = int(input())
LIST = list(map(int, input().split()))

print(max(LIST) - min(LIST))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

n = int(arr_data[0][0])

arr=sorted(list(map(int, arr_data[1])))

print(arr[-1:][0]-arr[0])

Submission status: Accepted

Solution code:
n = int(input())
a = input().split()
a.sort()
print(int(a[n - 1]) - int(a[0]))

Submission status: Accepted

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

Submission status: Accepted

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