#include <bits/stdc++.h>
using namespace std;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long C(int n, int r) {
  if (r > n - r) r = n - r;
  long long ans = 1;
  int i;
  for (i = 1; i <= r; i++) {
    ans *= n - r + i;
    ans /= i;
  }
  return ans;
}
int n;
vector<vector<int>> arr(50, vector<int>(50));
int dp[50][50];
void solve() {
  long long n, a, b, c, p, q, r, s, t, x, avg;
  long long i;
  cin >> n;
  vector<long long> a1(n), a2(n);
  for (i = 0; i < n; i++) {
    cin >> a1[i];
  }
  long long xmax = *max_element(a1.begin(), a1.end());
  long long xmin = *min_element(a1.begin(), a1.end());
  if (xmax == xmin) {
    long long aaa = (n * (n - 1)) / 2;
    cout << 0 << ' ' << aaa;
    return;
  }
  long long t1 = 0, t2 = 0;
  for (i = 0; i < n; i++) {
    if (a1[i] == xmax) t1++;
    if (a1[i] == xmin) t2++;
  }
  cout << xmax - xmin << ' ' << t1 * t2 << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
}
