#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, ans = 0, x = 0, y = 0, z = 0;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  ans = a[n - 1] - a[0];
  for (int i = 0; i < n; i++) {
    if (a[n - i - 1] == a[n - 1]) x++;
    if (a[i] == a[0]) y++;
  }
  if (a[0] != a[n - 1])
    z = x * y;
  else
    z = (x * (x - 1)) / 2;
  cout << ans << " " << z;
  return 0;
}
