#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define _CRT_SECURE_NO_WARNINGS #define REP(i, n) for(int i=0; i<(n); i++) #define FOR(i, m, n) for(int i=(m);i<(n);i++) #define SZ(x) ((int)(x).size()) #define ALL(x) (x).begin(),(x).end() #define SORT(x) sort((x).begin(),(x).end()) #define REVE(x) reverse((x).begin(),(x).end()) #define MP make_pair #define PB push_back typedef vector VI; typedef vector VS; typedef vector> VVI; typedef pair PII; typedef long long LL; int main() { int n; cin >> n; VI a(n); REP(i, n)cin >> a[i]; SORT(a); int diff; REP(i, n - 1) { if (i == 0)diff = a[i + 1] - a[i]; else if (diff > a[i + 1] - a[i])diff = a[i + 1] - a[i]; } int max = *max_element(ALL(a)); int min = *min_element(ALL(a)); cout << diff << endl << max - min << endl; }