# -*- coding: utf-8 -*- n = int(input()) a = list(map(int,input().split())) maxlen = 0 minlen = 1000000 for i in range(n): for j in range(i+1,n): temp = abs(a[i] - a[j]) maxlen = max(temp, maxlen) minlen = min(temp, minlen) print(minlen) print(maxlen)