#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const int N = 200100;
int n;
int b[N];
long long int cnt(int v) {
  int c = 0;
  for (int i = (int)(0); i < (int)(n); i++) {
    if (b[i] == v) c++;
  }
  return c;
}
int main(void) {
  cin >> n;
  for (int i = (int)(0); i < (int)(n); i++) cin >> b[i];
  int ma = b[0], mi = b[0];
  for (int i = (int)(0); i < (int)(n); i++) {
    ma = max(ma, b[i]);
    mi = min(mi, b[i]);
  }
  if (ma != mi) {
    cout << (ma - mi) << " " << cnt(ma) * cnt(mi) << endl;
  } else {
    long long int c = cnt(ma);
    cout << 0 << " " << c * (c - 1) / 2 << endl;
  }
}
