#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846;
const long long mod = 1e9 + 7;
void unify(vector<int>& v) {
  auto ip = unique(v.begin(), v.end());
  v.resize(distance(v.begin(), ip));
}
long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }
void solve() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  if (v[0] == v.back()) {
    cout << 0 << " " << (long long)n * (n - 1) / 2 << endl;
    return;
  }
  long long j = n - 1, cnt_1 = 0, cnt_2 = 0;
  while (v[j] == v[n - 1]) {
    j--;
    cnt_1++;
  }
  j = 0;
  while (v[j] == v[0]) {
    j++;
    cnt_2++;
  }
  cout << v[n - 1] - v[0] << " " << cnt_1 * cnt_2 << endl;
}
int main() {
  int t = 1;
  while (t--) solve();
}
