#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    int mi = 1 << 30, ma = -1;
    long long int miCount = 0, maCount = 01;
    for (int i = 0; i < n; ++i) {
      int b;
      cin >> b;
      if (b < mi) mi = b, miCount = 0;
      if (b > ma) ma = b, maCount = 0;
      if (b == mi) ++miCount;
      if (b == ma) ++maCount;
    }
    cout << ma - mi << " "
         << (mi == ma ? miCount * (miCount - 1) / 2 : miCount * maCount)
         << endl;
  }
  return 0;
}
