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