#include <bits/stdc++.h>
using namespace std;
long long a[200006];
int main() {
  int n, i;
  long long m = 1, l = 1;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (i = 1; i < n; i++) {
    if (a[0] == a[i]) m++;
    if (a[n - 1] == a[n - 1 - i]) l++;
  }
  if (a[0] == a[n - 1])
    cout << "0 " << l * (m - 1) / 2;
  else
    cout << a[n - 1] - a[0] << " " << l * m;
  return 0;
}
