#include <bits/stdc++.h>
using namespace std;
map<int, int> q;
int main() {
  int Max = -1, Min = (1 << 31) - 1;
  long long n;
  int num[300000];
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> num[i];
    Max = max(num[i], Max);
    Min = min(Min, num[i]);
    q[num[i]]++;
  }
  if (q.size() == 1) {
    cout << "0"
         << " " << n * (n - 1) / 2 << endl;
  } else {
    long long ans1 = 0;
    long long ans2 = 0;
    for (int i = 1; i <= n; i++) {
      if (num[i] == Max) {
        ans1++;
      }
      if (num[i] == Min) {
        ans2++;
      }
    }
    cout << Max - Min << " " << ans1 * ans2 << endl;
  }
  return 0;
}
