#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, c1 = 1, c2 = 1;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  long long int x = a[0], y = a[n - 1], p = 1, q = n - 2;
  if (x == y) {
    cout << 0 << " " << (n * (n - 1)) / 2;
    ;
  } else {
    while (x == a[p]) {
      c1++;
      p++;
    }
    while (y == a[q]) {
      c2++;
      q--;
    }
    cout << y - x << " " << c1 * c2;
  }
}
