#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x;
  vector<long long> v;
  cin >> x;
  long long max = 0;
  for (long long i = 0; i < x; i++) {
    long long temp;
    cin >> temp;
    v.push_back(temp);
  }
  sort(v.begin(), v.end());
  max = v[v.size() - 1] - v[0];
  cout << max << " ";
  long long x1 = 1;
  long long x2 = 1;
  for (long long i = 1; i < x - 1; i++) {
    if (v[i] == v[0]) x1++;
    if (v[i] == v[x - 1]) x2++;
  }
  if (v[0] == v[x - 1])
    cout << x * (x - 1) / 2;
  else
    cout << x1 * x2;
  return 0;
}
