#include <bits/stdc++.h>
using namespace std;
struct _ {
  ios_base::Init i;
  _() {
    cin.sync_with_stdio(0);
    cin.tie(0);
  }
} _;
long long power(long long a, long long n) {
  long long ans = 1;
  while (n) {
    if (n % 2 == 1) ans *= a;
    a *= a;
    n /= 2;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  int r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
int main() {
  int n, i, ans;
  cin >> n;
  int a[n + 2];
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  ans = a[n - 1] - a[0];
  i = n - 2;
  long long c1 = 1, c2 = 1;
  while (i >= 0) {
    if (a[i] == a[i + 1]) {
      c2++;
      i--;
    } else
      break;
  }
  int j = 1;
  while (j < n) {
    if (a[j] == a[j - 1]) {
      c1++;
      j++;
    } else
      break;
  }
  long long temp;
  if (j == n)
    temp = c2 * (c2 - 1) / 2;
  else
    temp = c1 * c2;
  cout << ans << " " << temp << "\n";
  return 0;
}
