#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> flowers;
  int n;
  cin >> n;
  int M = 0;
  int m = 2147483647;
  for (int i = 0; i < n; ++i) {
    int tmp;
    cin >> tmp;
    flowers.push_back(tmp);
    if (tmp < m) {
      m = tmp;
    }
    if (tmp > M) {
      M = tmp;
    }
  }
  unsigned long long n_M = 0;
  unsigned long long n_m = 0;
  for (int i = 0; i < n; ++i) {
    if (flowers[i] == M) {
      ++n_M;
    }
    if (flowers[i] == m) {
      ++n_m;
    }
  }
  if (M == m) {
    cout << M - m << " " << n_m * (n_m - 1) / 2 << endl;
  } else {
    cout << M - m << " " << n_M * n_m << endl;
  }
}
