import sys input = sys.stdin.readline N=int(input()) A=list(map(int,input().split())) MIN=1<<60 MAX=0 for i in range(N): for j in range(i+1,N): dis=abs(A[i]-A[j]) MIN=min(MIN,dis) MAX=max(MAX,dis) print(MIN) print(MAX)