#include <bits/stdc++.h>
using namespace std;
long long int b[300000];
int main() {
  long long int maxdif, ctr1, ctr2, num, n, i;
  cin >> n;
  for (i = 0; i < n; i++) cin >> b[i];
  sort(b, b + n);
  ctr1 = ctr2 = 0;
  maxdif = b[n - 1] - b[0];
  for (i = 0; i < n; i++) {
    if (b[i] == b[0]) ctr1++;
    if (b[n - 1 - i] == b[n - 1]) ctr2++;
  }
  if (b[n - 1] != b[0])
    cout << maxdif << " " << ctr1 * ctr2 << endl;
  else
    cout << maxdif << " " << (n * (n - 1)) / 2 << endl;
}
