#!/usr/bin/env python3

import numpy as np

import math

import re

n = int(eval(input()))

a = eval(input())

a = re.split(" ",a)



max = 0

min = 10**9

for i in range(n):

    if(int(a[i]) > max):

        max = int(a[i])

    if(int(a[i]) < min):

        min = int(a[i])

print((max - min))
#!/usr/bin/env python3

#ABC102 B



N = int(eval(input()))

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



ans = 0

for i in range(1,N):

    for j in range(i):

        if ans < abs(A[i]-A[j]):

            ans = abs(A[i]-A[j])

print(ans)

#!/usr/bin/env python3
import numpy as np
import math
import re

n = int(eval(input()))
a = eval(input())
a = re.split(" ", a)
max = 0
min = 10**9
for i in range(n):
    if int(a[i]) > max:
        max = int(a[i])
    if int(a[i]) < min:
        min = int(a[i])
print((max - min))

#!/usr/bin/env python3
# ABC102 B
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
for i in range(1, N):
    for j in range(i):
        if ans < abs(A[i] - A[j]):
            ans = abs(A[i] - A[j])
print(ans)

-import numpy as np -import math -import re - -n = int(eval(input())) -a = eval(input()) -a = re.split(" ", a) -max = 0 -min = 10**9 -for i in range(n): -    if int(a[i]) > max: -        max = int(a[i]) -    if int(a[i]) < min: -        min = int(a[i]) -print((max - min)) +# ABC102 B +N = int(eval(input())) +A = list(map(int, input().split())) +ans = 0 +for i in range(1, N): +    for j in range(i): +        if ans < abs(A[i] - A[j]): +            ans = abs(A[i] - A[j]) +print(ans)