#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, mx, mn;
int a[200010];
long long ans, m1, m2;
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  sort(a + 1, a + n + 1);
  mn = a[1];
  mx = a[n];
  for (int i = 1; i <= n; i++) {
    if (a[i] == mx) m1++;
    if (a[i] == mn) m2++;
  }
  ans = m1 * m2;
  if (mx == mn) ans = (long long)(n - 1) * n / 2;
  printf("%d %lld", mx - mn, ans);
}
