#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int arr[n];
  for (auto i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  long long int leastNumCount = 0, maxNumCount = 0, numberOfWays = 0;
  ;
  for (long long int i : arr) {
    if (i == arr[0])
      leastNumCount++;
    else
      break;
  }
  if (arr[0] == arr[n - 1])
    numberOfWays = (n * (n - 1)) / 2;
  else {
    for (long long int i = n - 1; i >= 0; i--) {
      if (arr[i] == arr[n - 1])
        maxNumCount++;
      else
        break;
    }
    numberOfWays = leastNumCount * maxNumCount;
  }
  cout << arr[n - 1] - arr[0] << " " << numberOfWays;
  return 0;
}
