#include <bits/stdc++.h>
using namespace std;
int a[200000];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  cout << a[n - 1] - a[0] << " ";
  long long int t1 = 0, t2 = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == a[0]) {
      t1++;
    } else if (a[i] == a[n - 1]) {
      t2++;
    }
  }
  if (t2 == 0) {
    cout << t1 * (t1 - 1) / 2;
    return 0;
  }
  cout << t1 * t2;
}
