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-----
4
1 4 6 3

-----Sample Output-----
5

The maximum absolute difference of two elements is A_3-A_1=6-1=5.

Difficulty: EASY

Starter code:

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


N = int(input())
data = list(map(int, input().split()))
max = 0
min = 1000000000
for i in range(len(data)):
	if max < data[i]:
		max = data[i]
	if min > data[i]:
		min = data[i]
print(max - min)


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


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


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


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


N = int(input())
S = map(int, input().split())
Number = list(S)
Maxi = max(Number)
Mini = min(Number)
print(Maxi - Mini)


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


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


import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque, Counter
from decimal import Decimal
import functools

def v():
	return input()

def k():
	return int(input())

def S():
	return input().split()

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

def X():
	return list(input())

def L():
	return list(input().split())

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

def lcm(a, b):
	return a * b // math.gcd(a, b)
sys.setrecursionlimit(10 ** 6)
mod = 10 ** 9 + 7
cnt = 0
ans = 0
inf = float('inf')
al = 'abcdefghijklmnopqrstuvwxyz'
AL = al.upper()
a = k()
b = l()
b.sort()
print(abs(b[0] - b[-1]))


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


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


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


N = int(input())
A = [int(a) for a in input().split()]
lists = [abs(A[i] - A[j]) for i in range(N) for j in range(N)]
print(max(lists))


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


N = int(input())
lst = input().split()
for i in range(N):
	lst[i] = int(lst[i])
print(abs(max(lst) - min(lst)))


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


n = int(input())
min_A = 10 ** 9 + 7
max_A = -1
for i in input().split():
	tmp = int(i)
	max_A = max(tmp, max_A)
	min_A = min(min_A, tmp)
print(abs(max_A - min_A))


def mapt(fn, *args):
	return list(map(fn, *args))

def Input():
	return mapt(int, input().split(' '))

def main():
	n = int(input())
	a = Input()
	print(max(a) - min(a))
main()


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


num_len = int(input())
numbers = list(map(int, input().split()))
print(max(numbers) - min(numbers))


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


N = int(input())
my_list = list(map(int, input().split(maxsplit=N)))
my_list_sort = sorted(my_list, reverse=True)
answer = my_list_sort[0] - my_list_sort[-1]
print(answer)


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


import itertools

def get_input() -> tuple:
	N = int(input())
	A = list(map(int, input().split()))
	return (N, A)

def main(A: list) -> None:
	ans = 0
	for (A_i, A_j) in itertools.combinations(A, r=2):
		ans = max(ans, abs(A_i - A_j))
	print(ans)

def __starting_point():
	(N, A) = get_input()
	main(A)
__starting_point()


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


import itertools
N = int(input())
A = map(int, input().split())
score = 0
for (i, j) in list(itertools.combinations(A, 2)):
	if score < abs(i - j):
		score = abs(i - j)
print(score)


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


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


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

def answer(n: int, a: list) -> int:
	return max(a) - min(a)
print(answer(n, a))


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


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


S_list = [input() for i in range(2)]
N = map(int, S_list[0].split())
A_list = list(map(int, S_list[1].split()))
A_max = max(A_list)
A_min = min(A_list)
A_abs = abs(A_max - A_min)
print(A_abs)


N = int(input())
A = list(map(int, input().split()))
diffmax = 0
for i in range(N):
	for j in range(1, N):
		diff = abs(A[i] - A[j])
		if diff > diffmax:
			diffmax = diff
print(diffmax)


import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
	for j in range(N):
		ans = max(ans, abs(A[i] - A[j]))
print(ans)


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


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


def atc_102b(N: int, Ai_input: str) -> int:
	Ai = [int(i) for i in Ai_input.split(' ')]
	return max(Ai) - min(Ai)
N_input_value = int(input())
Ai_input_value = input()
print(atc_102b(N_input_value, Ai_input_value))


N = int(input())
A = list(map(int, input().split()))
Amax = max(A)
Amin = min(A)
ans = Amax - Amin
print(ans)


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


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


N = int(input())
a_list = list(map(int, input().split()))
max_ = abs(max(a_list) - min(a_list))
print(max_)


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


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


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


from math import gcd
from itertools import combinations, permutations, accumulate, product
from collections import deque, defaultdict, Counter
import decimal
import re
import math
import bisect
import heapq
import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7
INF = float('inf')
from sys import stdin
readline = stdin.readline

def readInts():
	return list(map(int, readline().split()))

def readTuples():
	return tuple(map(int, readline().split()))

def I():
	return int(readline())
n = I()
A = readInts()
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)


N = int(input())
A = list(map(int, input().split()))
sub = []
for i in A:
	for j in A:
		sub.append(abs(i - j))
descending_sub = sorted(set(sub), reverse=True)
print(descending_sub[0])


def diff_list_max(l: list) -> int:
	return abs(max(l) - min(l))

def __starting_point():
	n = int(input())
	l = list(map(int, input().split()))
	print(diff_list_max(l))
__starting_point()


N = int(input())
nums = [int(s) for s in input().split()]
ans = max(nums) - min(nums)
print(ans)


def get_input() -> tuple:
	N = int(input())
	A = list(map(int, input().split()))
	return (N, A)

def main(A: list) -> None:
	ans = max(A) - min(A)
	print(ans)

def __starting_point():
	(N, A) = get_input()
	main(A)
__starting_point()


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


n = list(map(int, input().split()))
a = list(map(int, input().split()))
ma = a.index(max(a))
mi = a.index(min(a))
print(a[ma] - a[mi])


n = int(input())
lista = input().split()
p = int(lista[0])
q = int(lista[0])
for i in range(1, n):
	k = int(lista[i])
	if k <= p:
		p = k
	elif k >= q:
		q = k
print(int(q - p))


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


import itertools
N = int(input())
A = list(map(int, input().split()))
ans = 0
for (A_i, A_j) in itertools.combinations(A, r=2):
	ans = max(ans, abs(A_i - A_j))
print(ans)


(N, *A) = list(map(int, open(0).read().split()))
(mx, mn) = (0, 1000000000)
for a in A:
	mx = max(mx, a)
	mn = min(mn, a)
print(mx - mn)


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


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


N = int(input())
l = [int(i) for i in input().split()]
m = []
for i in range(N):
	for j in range(i):
		m.append(abs(l[i] - l[j]))
print(max(m))


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


N = input()
Nums = list(map(int, input().split()))
result = 0
for i in Nums:
	for ii in Nums:
		if result < abs(i - ii):
			result = abs(i - ii)
print(result)


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


n = int(input())
num = list(map(int, input().split()))
ans = 0
for i in range(n):
	for j in range(i, n):
		num1 = abs(num[i] - num[j])
		if ans <= num1:
			ans = num1
print(ans)