#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  long long ans1 = a[n - 1] - a[0];
  long long ans2 =
      (long long)count(a, a + n, a[n - 1]) * (long long)count(a, a + n, a[0]);
  if (ans1 == 0) ans2 = (long long)n * (long long)(n - 1) / 2;
  cout << ans1 << ' ' << ans2 << endl;
  return 0;
}
