#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, min = 2000000000, max = 1;
  long long ans, cnt_min = 0, cnt_max = 0;
  cin >> n;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (min > arr[i]) min = arr[i];
    if (max < arr[i]) max = arr[i];
  }
  for (int i = 0; i < n; i++) {
    if (arr[i] == min) cnt_min++;
    if (arr[i] == max) cnt_max++;
  }
  if (max != min) {
    ans = cnt_min * cnt_max;
    cout << max - min << " " << ans;
  } else {
    ans = (cnt_min) * (cnt_min - 1) / 2;
    cout << max - min << " " << ans;
  }
}
