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

Submission status: Accepted

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

Submission status: Accepted

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

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    house_count = int(input())
    coordinates = list(map(int, input().split()))
    print(max(coordinates) - min(coordinates))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

max = 0
min = 1005
for i in a:
    if(i > max):
        max = i
    if(i < min):
        min = i

print(max - min)

Submission status: Accepted

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

Submission status: Accepted

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

print(max(xs) - min(xs))

Submission status: Accepted

Solution code:
N = int(input())
L=input().split(' ')
Lint = []
for i in L:
    Lint.append(int(i))
Lint.sort()
print(str(Lint[-1]-Lint[0]))

Submission status: Accepted

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

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

print(sum)

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

Submission status: Accepted

Solution code:
input()


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

a = min(xs)
b = max(xs)

print(b-a)

Submission status: Accepted

Solution code:
ignore = input()
l = map(int, raw_input().split())
l.sort()
counter = 0
for i in range(1,len(l)):
    counter = counter + l[i]-l[i-1]

print counter

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    A = list(map(int, input().split(" ")))
    houses = []
    for a in A:
        if not a in houses:
            houses.append(a)
        else:
            pass

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

    print(ans)


solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

len.sort()

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

Submission status: Accepted

Solution code:
#!/ust/bin/env python

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
http://abc064.contest.atcoder.jp/tasks/abc064_b

"""
import sys
from sys import stdin

input = stdin.readline


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


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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(max-min)

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

DEBUG = True
DEBUG = False

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



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

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

if __name__ == "__main__": main()

Submission status: Accepted

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

a.sort()
ans = a[n-1] - a[0]
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:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from collections import deque

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

min = float('inf')
max = 0

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

	if a > max:
		max = a

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print( i - j )

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
a=input().split()
a.sort()
result=int(a[N-1])-int(a[0])
print(result)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# encoding:utf-8
def main():
	N = int(input())
	houses = list(map(int, input().split()))
	print(max(houses) - min(houses))
	
if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
from collections import defaultdict


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
input_line_1 = raw_input()
input_line_2 = raw_input()
#N = int(input_line_1)
array = [int(i) for i in input_line_2.split(" ")]
print max(array) - min(array)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#Traveling AtCoDeer Problem

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

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:
import numpy as np

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
def solve():
    N = input()
    a = input().split()
    a.sort()
    n = 0
    for i in range (0, len(a) - 1):
        n += int(a[i+1]) - int(a[i])
    print(n)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

        if buf_a < min_a:
            min_a = buf_a

    return max_a-min_a

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

    print(get_min_root_num(a_list))

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(distance)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
x = int(input())
#x = 8
 
y = input().split()
#y = ["3","1","4","1","5","9","2","6"]
 
for i in range(x):
    y[i] = int(y[i])
 
Max = max(y)
Min = min(y)
 
ans = Max - Min
 
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 = input()
a = []
a.append(map(int, raw_input().split()))

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

Submission status: Accepted

Solution code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math

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

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


exit(0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(x-n)

Submission status: Accepted

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

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

Submission status: Accepted

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

print(max-min)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC064B

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
# -*- coding: utf-8 -*-

N = int(input())

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

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

print(a)

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(str(l_max - l_min))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#coding: utf-8
N = int(raw_input())
homes = map(int, raw_input().split(' '))
mindist = min(homes)
maxdist = max(homes)
print maxdist - mindist

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
AtCoder Beginner Contest 064
B - Traveling AtCoDeer Problem
@author haru
"""

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys
# sys.stdin=open("b1.in")

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

Submission status: Accepted

Solution code:
N=int(input())

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

a=sorted(a)

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

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

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

Submission status: Accepted

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

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

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


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


print(main())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


n = ni()
a = na()

a = sorted(a)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
 
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()]

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

print (ma - mi)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

import sys
import os

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

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

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

Submission status: Accepted

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

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

print(right - left)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

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

print max(a) - min(a)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

house.sort()

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 28 21:42:33 2016

@author: you
"""

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

Submission status: Accepted

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

#a.sort

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

Submission status: Accepted

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

a.sort

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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



quit()

Submission status: Accepted

Solution code:
#Python

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

i=0
while i<N:
	#print A[i]
	i+=1


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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

print max(a) - min(a)

Submission status: Accepted

Solution code:
def main():
    # not use N
    _ = int(input().strip())

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

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

    print dist



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#4
#2 3 7 9

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

Submission status: Accepted

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

print (b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
L = input().split()

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

Submission status: Accepted

Solution code:
import numpy as np

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

    print(s)

Submission status: Accepted

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

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

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:



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

    xs.sort()

    print xs[-1] - xs[0]


main()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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