#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k, x;
  cin >> n;
  vector<long long> b(n);
  map<int, long long> mp;
  for (auto &it : b) cin >> it;
  sort(b.begin(), b.end());
  x = b[n - 1] - b[0];
  for (int i = 0; i < n; i++) {
    mp[b[i]]++;
  }
  if (b[0] == b[n - 1])
    k = n * (n - 1) / 2;
  else
    k = mp[b[0]] * mp[b[n - 1]];
  cout << x << " " << k << "\n";
}
