#define _USE_MATH_DEFINES #include //cin, cout #include //vector #include //sort,min,max,count #include //string,getline, to_string #include //fixed #include //setprecision #include //swap, pair #include //abs(int) #include //sqrt,ceil,M_PI, pow, sin #include //stringstream,getline #include //gcd, accumlate #include //deque #include //randam_device #include //numeric_limits using namespace std; constexpr long long int D_MOD = 1000000007; int main() { int N; cin >> N; vector A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } sort(A.begin(), A.end()); int max = A[N - 1] - A[0]; int min = numeric_limits::max(); for (int i = 0; i < N - 1; i++) { for (int j = i + 1; j < N; j++) { if (A[j] - A[i] < min) { min = A[j] - A[i]; } if (min == 0) { break; } } if (min == 0) { break; } } cout << min << endl; cout << max << endl; return 0; }