#include <bits/stdc++.h>
using namespace std;
int b[200010];
int main() {
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d", &b[i]);
  sort(b, b + n);
  int m = b[n - 1] - b[0];
  int m1 = b[n - 1], m2 = b[0];
  long long c1 = 0, c2 = 0;
  for (int i = 0; i < n; i++) {
    if (b[i] == m1) c1++;
    if (b[i] == m2) c2++;
  }
  printf("%d ", m);
  if (m1 == m2)
    cout << n * (n - 1) / 2 << endl;
  else
    cout << c1 * c2 << endl;
  return 0;
}
