Problem:
 Score : 200 points    Problem Statement You are given an integer sequence A of length N .
Find the maximum absolute difference of two elements (with different indices) in A .      Constraints  2 \leq N \leq 100  1 \leq A_i \leq 10^9  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  A_1  A_2  ...  A_N       Output Print the maximum absolute difference of two elements (with different indices) in A .        Sample Input 1 4
1 4 6 3      Sample Output 1 5  The maximum absolute difference of two elements is A_3-A_1=6-1=5 .       Sample Input 2 2
1000000000 1      Sample Output 2 999999999       Sample Input 3 5
1 1 1 1 1      Sample Output 3 0

Solution (Python):
def main():
    n = int(input())
    a = list(map(int, input().split()))

    dif_max = -1
    for i in range(n):
        for j in range(n):
            if abs(a[i]-a[j]) > dif_max and i != j:
                dif_max = abs(a[i]-a[j])

    print(dif_max)


if __name__ == '__main__':
    main()

Solution (Python):
if __name__ == "__main__":
    n = int(input())
    xs = [int(s) for s in input().split()]
    print(max(xs) - min(xs))

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

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

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

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


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
A = [int(i) for i in input().split()]

a = max(A)
b = min(A)

ans = abs(a - b)

print(ans)

Solution (Python):
N = int(input().strip())
A = list(map(int,input().strip().split(' ')))
import itertools

ans = 0
for c in itertools.combinations(A,2):
    ans = max(ans,abs(c[0]-c[1]))
print(ans)

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

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

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


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

Solution (Python):
from sys import stdin


def main():
    N = int(stdin.readline().rstrip())
    A = [int(x) for x in stdin.readline().rstrip().split()]
    print(max(A) - min(A))


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
a=map(int,input().split())
b=0
c=10**9
for i in a:
    b=max(i,b)
    c=min(i,c)
print(b-c)

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

Solution (Python):
N = input()
inp = [int(x) for x in input().split()]

print(max(inp) - min(inp))

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

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

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

ans = 0
for i in range(N):
    for j in range(i, N):
        ans = max(ans, abs(A[i] - A[j]))
print(ans)

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

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


M = max(A)
m = min(A)

print(M-m)

Solution (Python):
N=input()
A=map(int, raw_input().split())
A.sort(reverse=True)
print A[0]-A[-1]

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

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

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

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

Solution (Python):
def main():
    N = int(input())
    *A, = map(int, input().split())

    ans = f(N, A)
    print(ans)


def f(N, A):
    ans = -float("inf")
    for i, a1 in enumerate(A):
        for j, a2 in enumerate(A):
            if i != j:
                ans = max(ans, abs(a1 - a2))

    return ans


if __name__ == '__main__':
    main()

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

max = 0
min = 10 ** 9

for a in A:
    if a > max:
        max = a
    if a < min:
        min = a
print(max - min)

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

if max(a) - min(a) > 0:
    print(max(a)-min(a))
else:
    print(min(a) - max(a))

Solution (Python):
size = input()
array = list(map(int, input().split(' ')))
print(max(array)-min(array))

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

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

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

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


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

Solution (Python):
N = int(raw_input())
A = map(int, raw_input().split())

ans = -1

for i in range(N-1):
    for j in range(i+1, N):
        ans = max(ans, abs(A[i] - A[j]))

print ans

Solution (Python):
N=int(input())
A=input()
A=A.rstrip().split(" ")
list1=[]
for i in range(len(A)):
    list1.append(int(A[i]))
list1.sort()
print(list1[N-1]-list1[0])

Solution (Python):

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

Solution (Python):
def ketanowa(p):
    ans = 0
    p = str(p)
    for i in p:
        ans += int(i)
    return ans


def main():
    temp1 = input()
    temp1 = input()

    temp1 = temp1.split(" ")
    
    temp1 = list(map(int,temp1))
    temp1.sort()
    
    print(abs(temp1[0]-temp1[-1]))

if __name__ == '__main__':
    main()

Solution (Python):
def inpl(): return list(map(int, input().split()))
N = int(input())
A = inpl()
ans = 0
for i in range(N):
    for j in range(N):
        if i==j:
            continue
        ans = max(ans, abs(A[i]-A[j]))
print(ans)

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

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

Solution (Python):
from sys import stderr
from functools import reduce
from operator import add
def f(): return [int(i) for i in input().split()]
def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(repr(item))
        stderr.write(sep)
    stderr.write(end)

n = int(input())
a = f()
abss = []
for i in range(n):
    for j in range(i,n):
        abss.append(abs(a[i] - a[j]))

print(max(abss))

Solution (Python):


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

saishou=min(S)
saidai=max(S)
print(max(S)-min(S))

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

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

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

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

Solution (Python):
N = int(input())
A_l = list(map(int, input().split(" ")))

print(max(A_l) - min(A_l))

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

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

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

Solution (Python):
import math

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

tmp = -1

for i in range(N):
  pa = A[i]
  for j in range(N):
    if tmp < abs(pa - A[j]):
      tmp = abs(pa - A[j])

print(tmp)

Solution (Python):
from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
write = stdout.write

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

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

main()

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
    for k in range(i,n):
        tem = abs(a[i]-a[k])
        ans = max(tem,ans)

print(ans)

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

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

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

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

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

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

Solution (Python):

N = int(input())
l = list(map(int, input().split(" ")))


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

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

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

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]

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

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

max = 0

for i in range(n):
    for j in range(n):
        if abs(a[i] - a[j]) > max:
            max = abs(a[i] - a[j])
print(max)

Solution (Python):
N = int(input())
A_list = [int(elem) for elem in input().split(' ')]
assert len(A_list) == N

max_A = max(A_list)
min_A = min(A_list)
print(max_A - min_A)

Solution (Python):
input()
A_list = list(map(int, input().split()))

max_A = max(A_list)
min_A = min(A_list)

print(max_A - min_A)

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


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

Solution (Python):


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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
    for j in range(n):
        ans=max(ans,a[i]-a[j])
print(ans)

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

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

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

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

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

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

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

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

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

Solution (Python):
N = int(input())
 
nums = list(map(int,input().split()))

nums.sort()

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

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

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
ans = 0
for a in A:
    for b in A:
        ans = max(ans, abs(a - b))
print(ans)

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

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

a =min(A)
b=max(A)
print(b-a)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
min0 = 10**9+1
max0 = 0
for i in range(n):
    min0 = min(min0, a[i])
    max0 = max(max0, a[i])

print(max0 - min0)

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

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

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

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

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

Solution (Python):
N = int(input())
A = [int(x) for x in input().split(' ')]
print(max(A) - min(A))

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]
print(abs(max(A) - min(A)))

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

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

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

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

Solution (Python):
N=int(input().strip())
A=list(map(int, input().strip().split()))
mx=0
for i in range(N-1):
    for j in range(i+1,N):
        if abs(A[i]-A[j]) > mx:
            mx=abs(A[i]-A[j])
print(mx)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
ans = 0
for k in A:
    for l in A:
        ans = max(ans, abs(k-l))
print(ans)

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

r = 0
for x in A:
    for y in A:
        r = max(x - y, r)

print(r)

Solution (Python):


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

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

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

Solution (Python):
n = int(input())
P = list(map(int,input().split()))
a, b = max(P), min(P)
print(abs(a - b))

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

Solution (Python):
n = int(input())
array = [int(x) for x in input().split()]
print(abs(max(array)-min(array)))

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

Solution (Python):
N=int(input())
A=[int(x) for x in input().split()]

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

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

Solution (Python):
n = int(input())

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

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

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