#include <bits/stdc++.h>
using namespace std;
long long a[200005], sum1, sum2;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  printf("%d ", a[n] - a[1]);
  for (int i = 1; i <= n; i++)
    if (a[i] == a[1])
      sum1++;
    else
      break;
  for (int i = n; i; i--)
    if (a[i] == a[n])
      sum2++;
    else
      break;
  if (sum1 == n && sum2 == n)
    printf("%lld", 1LL * (sum1 * (sum1 - 1)) / 2);
  else
    printf("%lld", 1LL * sum1 * sum2);
}
