#include <bits/stdc++.h>
int main(void) {
  int n, a[1000], i, j, k, max, min;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  min = max = a[0];
  for (i = 1; i < n; i++) {
    if (a[i] > max) max = a[i];
  }
  for (i = 1; i < n; i++) {
    if (a[i] < min) min = a[i];
  }
  printf("%d %d\n", max, min);
  printf("%d", max - min);
  return 0;
}
