#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  int max = -1;
  int min = 1001;
  for (int i = 0; i < N; i++) {
    if (max < a[i]) max = a[i];
    if (min > a[i]) min = a[i];
  }
  cout << max << min << endl;
  cout << max - min << endl;
  return 0;
}
