#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> kyori;
  int n, in, unso = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> in;
    kyori.push_back(in);
  }
  sort(kyori.begin(), kyori.end());
  for (int j = 0; j < kyori.size(); ++j) {
    cout << kyori[j] << endl;
  }
  unso = kyori[n - 1] - kyori[0];
  cout << unso;
  return 0;
}
