#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long n;
  long long t1(0), t2(0);
  long long mn = 0, mx = 0;
  cin >> n;
  vector<long> vec(n, 0);
  for (long i = 0; i < n; i++) {
    cin >> vec[i];
  }
  sort(vec.begin(), vec.end());
  mn = vec[0];
  mx = vec[n - 1];
  for (long i = 0; i < vec.size(); i++) {
    t1 += (vec[i] == mn);
    t2 += (vec[i] == mx);
  }
  cout << mx - mn << " ";
  if (mx - mn == 0)
    cout << n * (n - 1) / 2 << endl;
  else
    cout << t1 * t2 << endl;
}
