#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  long long n, arr[200010], arr2[200010];
  map<long long, long long> m;
  long long mx = -1, mn = 1e10, mxdif = -1, ans = 0;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> arr[i];
    m[arr[i]]++;
    if (arr[i] > mx) mx = arr[i];
    if (arr[i] < mn) mn = arr[i];
    if (mx - mn > mxdif) mxdif = mx - mn;
  }
  if (mx == mn)
    n % 2 == 0 ? (ans = n / 2 * (n - 1)) : (ans = (n - 1) / 2 * n);
  else
    ans = m[mx] * m[mn];
  cout << mxdif << " " << ans << endl;
  return 0;
}
