#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x, maxm = 1, minm = 1000000000, nomax = 0, nomin = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    if (maxm < x) {
      maxm = x;
      nomax = 1;
    } else if (maxm == x)
      nomax++;
    if (minm > x) {
      minm = x;
      nomin = 1;
    } else if (minm == x)
      nomin++;
  }
  if (minm != maxm)
    cout << maxm - minm << " " << nomax * nomin;
  else {
    cout << "0 " << (n * (n - 1)) / 2;
  }
  return 0;
}
