#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int min = 1000000000;
  int max = 0;
  int a[200005];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > max) max = a[i];
    if (a[i] < min) min = a[i];
  }
  long long ca = 0, ci = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == max) ca++;
    if (a[i] == min) ci++;
  }
  if (min != max)
    cout << max - min << " " << ca * ci << endl;
  else
    cout << max - min << " " << ca * (ci - 1) / 2 << endl;
}
