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:
_ = input()
lst = [int(i) for i in input().split()]

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

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

print(distance)

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

Submission status: Accepted

Solution code:
##### 解けた #####

import numpy as np

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

home = []

home = input().split()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

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

li.sort()

print(li[-1]-li[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:
input()
s=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()]
ans = max(A) - min(A)
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())
L = list(map(int,input().split()))
print(max(L) - min(L))

Submission status: Accepted

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

Submission status: Accepted

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

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:
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([int(a) for a in input().split()])
print(A[-1] - A[0])

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

Submission status: Accepted

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

print(aa[-1]-aa[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:
num = 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()))
A_set=set(A)
print(max(A_set)-min(A_set))

Submission status: Accepted

Solution code:
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_)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

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

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

a.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

Submission status: Accepted

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

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

A.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
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:
# ABC064 B Traveling AtCoDeer Problem
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))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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()))
a.sort()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#64b
N = int(input())
a_list = [int(e) for e in input().split()]

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

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

Submission status: Accepted

Solution code:
from sys import exit, stdin
N = int(stdin.readline().rstrip())
A = sorted([int(_) for _ in stdin.readline().rstrip().split()])
print(A[-1] - A[0])

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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

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

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

print(d)

Submission status: Accepted

Solution code:
# B - Traveling AtCoDeer Problem
N = int(input())
a = list(map(int, input().split()))

ans = max(a)-min(a)

print(ans)

Submission status: Accepted

Solution code:
# B - Traveling AtCoDeer Problem
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)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# ARC 064 B

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

Submission status: Accepted

Solution code:
n=int(input())
a=sorted(map(int,input().split()))
print(0 if n==1 else 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:
import sys
import os

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

Submission status: Accepted

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

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

ans = maxCoordinate - minCoordinate
print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
b = [abs(a[i]-a[i+1]) for i in range(n-1)]
print(sum(b))

Submission status: Accepted

Solution code:
#2019/09/26
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 = list(map(int, input().split()))
a.sort()
l = list(set(a))
print(max(l) - min(l))

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

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

print(M - m)

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

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:
n = int(input())

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

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

Submission status: Accepted

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

print(max(s)-min(s))

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

print(MAX - MIN)

Submission status: Accepted

Solution code:
_ = input()
s = list(map(int,input().split()))

print(max(s)-min(s))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

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

if __name__ == "__main__":
    main()

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()))
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:
#インポート
import sys

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import copy
import  math
import bisect
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(d)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# ABC064b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    test()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

# solve
a.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:



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

    print(sum(j-i for i,j in zip(strPositionSet,strPositionSet[1:])))

    


if __name__== "__main__":
    main()

Submission status: Accepted

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

print(x)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, a: "List[int]"):
    print(max(a)-min(a))
    return


def main():

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


if __name__ == '__main__':
    main()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

aLst.sort()

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

Submission status: Accepted

Solution code:
# ABC 64, B - travelling atcodeer
n = int(input())
A = sorted([int(el) for el in input().split(' ')])
print(max(A)-min(A))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    A = inputList()
    
    A.sort()
    
    print(A[-1] - A[0])
    
        
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, fractions, itertools


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


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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