#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  vector<long long int> vec(n, 0);
  unordered_map<long long int, long long int> umap;
  for (long long int i = 0; i < n; i++) {
    cin >> vec[i];
    umap[vec[i]]++;
  }
  sort(vec.begin(), vec.end());
  long long int ans = umap[vec[0]] * umap[vec[n - 1]];
  if (vec[0] == vec[n - 1]) {
    ans = (n - 1) * n / 2;
  }
  cout << vec[n - 1] - vec[0] << " " << ans << endl;
}
