#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int* p = new int[n];
  for (int i = 0; i < n; i++) cin >> p[i];
  int min = p[0], max = p[0], mincnt = 0, maxcnt = 0;
  for (int i = 0; i < n; i++) {
    if (p[i] < min)
      min = p[i];
    else if (p[i] > max)
      max = p[i];
  }
  if (min != max) {
    for (int i = 0; i < n; i++) {
      if (min == p[i])
        mincnt++;
      else if (p[i] == max)
        maxcnt++;
    }
    cout << max - min << " " << (long long int)mincnt * maxcnt;
  } else
    cout << 0 << " " << (long long int)n * (n - 1) / 2;
  return 0;
}
