#include <bits/stdc++.h>
using namespace std;
int a[10000005];
int main() {
  long long int n, i, maxi = 0, mini, c = 0, d = 0;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  mini = a[0];
  for (i = 0; i < n; i++) {
    if (a[i] > maxi) maxi = a[i];
    if (a[i] < mini) mini = a[i];
  }
  for (i = 0; i < n; i++) {
    if (a[i] == maxi) c++;
    if (a[i] == mini) d++;
  }
  if (maxi == mini)
    cout << 0 << " " << (n * (n - 1)) / 2;
  else
    cout << maxi - mini << " " << c * d;
  return 0;
}
