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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう

N=3
M=3
i=0
j=0
k=0



N=int(input())
dis_list=[]
housepos_list=list(map(int, input().split(" ")))#数字の時
#ソートして小さい順から差を求めていけばいいか
housepos_list=sorted(housepos_list)
for i in range(N-1):
    dis_list.append(housepos_list[i]-housepos_list[i+1])
print(abs(sum(dis_list)))
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"


#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    print(number_list[i-1])

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ

'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()#何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"




#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成

Submission status: Accepted

Solution code:
# B
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())
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:
num = int(input())
list = [int(x) for x in input().split()]

list.sort()

print(list[num-1]-list[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:
import sys
import math
# import decimal
# import queue
# import bisect
# import heapq # priolity-queue
# import time
# import itertools
# import collections # queue
# from operator import itemgetter
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

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

if __name__=='__main__':
    main()

Submission status: Accepted

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

A = list(set(a))
A.sort()

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

Submission status: Accepted

Solution code:
#abc064 b 
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(x) for x in input().split()])
print(a[-1] - a[0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    N=int(input())
    A=sorted(list(map(int,input().split())))

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




resolve()

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

Submission status: Accepted

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

a_L = sorted(a_L)

print(abs(a_L[0]-a_L[-1]))

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())
aa=list(map(int,input().split()))
aa.sort()
d=0
for i in range(1,len(aa)):
  d+=abs(aa[i]-aa[i-1])
print(d)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
mina = 1000
maxa = 0
A = list(map(int,input().split()))
for i in range(n):
  mina = min(mina,A[i])
  maxa = max(maxa,A[i])
print(maxa - mina)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

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

Submission status: Accepted

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    a=LI()
    print(max(a)-min(a))

main()

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

a_list.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC064

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
a = [int(x) for x in input().split()]
print(max(a)-min(a))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8

house_count = int(input().rstrip())
house_list = sorted(map(int, input().rstrip().split(" ")))
ans = house_list[house_count-1] - house_list[0]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    house_num = int(input())
    houses = sorted(set(list(map(int, input().split()))))
    print(houses[-1] - houses[0])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
l=sorted(list(map(int,input().split())))
print(l[N-1]-l[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_li = list(map(int, input().split()))
print(max(a_li) - min(a_li))

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())
L=list(map(int,input().split()))
M=sorted(list(set(L)))
ans=0
for i in range (len(M)-1):
  ans+=M[i+1]-M[i]
print(ans)

Submission status: Accepted

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

print(max(li)-min(li))

Submission status: Accepted

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

print(max(lst1)-min(lst1))

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

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 += a[i] - a[i-1]
print(ans)

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

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

Submission status: Accepted

Solution code:
n = int(input())
al = list(map(int, input().split()))
al.sort()
print(al[-1]-al[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:
N = int(input())
a = list(map(int,input().split()))
m = min(a)
M = max(a)
ans = M-m
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def christmas(s , a):

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

def main():
    s = int(input())
    a = list(map(int , input().split()))
    print(christmas(s , a))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


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

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

Submission status: Accepted

Solution code:
n = int(input())
str = input().split()
a_i = []
for x in range(n):
    a_i.append(int(str[x]))
a_i.sort()
print(a_i[n - 1] - a_i[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())
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()))

a.sort()
print(a[-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 = int(input())
A = sorted(set(map(int, input().split())))

ans = 0

for a_i in range(1, len(A)):
  ans += A[a_i]-A[a_i-1]
  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N=int(input())
A=list(map(int,input().split()))
A.sort()
print(A[N-1]-A[0])

Submission status: Accepted

Solution code:
# coding: utf-8
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)

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
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

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

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 30, Jan, 2020
"""

import sys
import itertools

# import numpy as np

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(input())
a = list(map(int,input().split()))
a.sort()
print(a[-1]-a[0])

Submission status: Accepted

Solution code:
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()))
print(max(A)-min(A))

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
a = [int(i) for i in input().split()]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N

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

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

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

Submission status: Accepted

Solution code:
x = input()

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

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
a = [int(i) for i in input().split()]
a.sort()
print(a[-1] - a[0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

print(points[-1] - points[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=input()

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

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

Submission status: Accepted

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

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

N = INT()
a = LIST()

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

Submission status: Accepted

Solution code:
n = int(input())

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

sorted = sorted(a)

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

    prev = p

print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


import numpy as np
import fractions as fra


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

Submission status: Accepted

Solution code:


import numpy as np
import fractions as fra


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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n = int(input())
l = sorted(map(int,input().split()))
print(l[-1]-l[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:
N = int(input())
s = list(map(int, input().split()))
ans=max(s)-min(s)
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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()))
sa=sorted(a)
total=0
for i in range(1,n):
    total += sa[i]-sa[i-1]

print(total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

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

A = np.array(list(A))
A = np.sort(A)
ans = np.diff(A, n=1) # x[1:] - x[:-x]

print(sum(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=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()))
max_A=max(A)
min_A=min(A)
print(max_A-min_A)

Submission status: Accepted

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

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

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(n-1):
    ans+=a[i+1]-a[i]
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())

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

A.sort()

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#H, W = map(int, input().split())
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()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
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 = input()
i = map(int, input().split())
i = list(i)

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

print(maior-menor)

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
n = input()

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

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

Submission status: Accepted

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

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

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,*a=map(int,open(0).read().split())
print(max(a)-min(a))

Submission status: Accepted

Solution code:
import sys

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

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

New_A = sorted(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(max(ls_a) - min(ls_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())
a=list(map(int,input().split()))
a.sort(reverse=True)
ans=0
before=a[0]
for i in a[1:]:
    ans+=before-i
    before=i
print(ans)

Submission status: Accepted

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