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