#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> nums(n);
  for (int i = 0; i < n; i++) {
    cin >> nums[i];
  }
  sort(nums.begin(), nums.end());
  int max_diff = nums[n - 1] - nums[0];
  int i = 0, j = n - 1;
  long long c1 = 0, c2 = 0;
  while (i < n && nums[i] == nums[0]) {
    i++;
    c1++;
  }
  while (j >= 0 && nums[j] == nums[n - 1]) {
    j--;
    c2++;
  }
  if (max_diff == 0) {
    cout << max_diff << " " << c1 * (c1 - 1) / 2;
  } else {
    cout << max_diff << " " << c1 * c2;
  }
  return 0;
}
