#include <bits/stdc++.h>
using namespace std;
long long combin(long long n) {
  long long ans = 1;
  int k = 0;
  while (k < 2) ans *= (n - k++);
  return ans / 2;
}
int main() {
  long long arr[200009];
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  long long diff = arr[n - 1] - arr[0];
  if (!diff) {
    cout << diff << " ";
    cout << combin(n);
    return 0;
  }
  long long cnt_mi = 1, cnt_ma = 1;
  for (int i = 1; i < n; i++)
    if (arr[i] == arr[0]) cnt_mi++;
  for (int i = n - 2; i >= 0; i--)
    if (arr[i] == arr[n - 1]) cnt_ma++;
  cout << diff << " " << cnt_mi * cnt_ma;
}
