#include <bits/stdc++.h>
using namespace std;
map<int, int> m;
int main() {
  int long long n;
  cin >> n;
  int long long arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  int long long a = 0, b = 0;
  if (arr[0] == arr[n - 1]) {
    cout << 0 << " " << n * (n - 1) / 2 << endl;
  } else {
    for (int i = 0; i < n; i++) {
      if (arr[i] == arr[0]) a++;
      if (arr[i] == arr[n - 1]) b++;
    }
    cout << arr[n - 1] - arr[0] << " " << a * b << endl;
  }
}
