#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  long long mn = INT_MAX, mx = -1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mn = min(mn, a[i]);
    mx = max(mx, a[i]);
  }
  if (mx == mn)
    cout << "0"
         << " " << n * (n - 1) / 2 << endl;
  else {
    cout << mx - mn << " ";
    long long s = 0, b = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] == mn) s++;
      if (a[i] == mx) b++;
    }
    cout << b * s << endl;
  }
}
