#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  long long int s = INT_MAX;
  long long int l = INT_MIN;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > l) {
      l = a[i];
    }
    if (a[i] < s) {
      s = a[i];
    }
  }
  long long int c = 0;
  long long int k = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == l) {
      c++;
    }
    if (a[i] == s) {
      k++;
    }
  }
  long long int z = c * k;
  if (l == s) {
    z = c * (c - 1) / 2;
  }
  cout << l - s << " " << z;
  return 0;
}
