#include <bits/stdc++.h>
using namespace std;
void precompute() {}
void test_case() {
  long long int n;
  cin >> n;
  ;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(begin(a), end(a));
  long long int i = 0;
  long long int cnt1 = 0;
  while (i < n && a[i] == a[0]) {
    cnt1++;
    i++;
  }
  if (cnt1 == n) {
    cout << 0 << " " << cnt1 * (cnt1 - 1) / 2 << endl;
  } else {
    long long int cnt2 = 0;
    long long int j = n - 1;
    while (j >= 0 && a[j] == a[n - 1]) {
      cnt2++;
      j--;
    }
    cout << a[n - 1] - a[0] << " " << cnt1 * cnt2 << endl;
  }
}
int32_t main() {
  srand(time(0));
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  precompute();
  long long int T = 1;
  for (long long int TT = 1; TT <= T; TT++) {
    test_case();
  }
  cerr << "Time : "
       << 1000 * ((long double)clock()) / (long double)CLOCKS_PER_SEC << "ms\n";
}
