#include <bits/stdc++.h>
int main() {
  long long i, n, *b, w, cmax = 0, cmin = 0, max, min;
  scanf("%lld", &n);
  b = (long long *)malloc(n * sizeof(long long));
  for (i = 0; i < n; i++) {
    scanf("%lld", &b[i]);
    if (i == 0)
      max = min = b[i];
    else if (b[i] > max)
      max = b[i];
    else if (b[i] < min)
      min = b[i];
  }
  if (max == min)
    w = n * (n - 1) / 2;
  else {
    for (i = 0; i < n; i++) {
      if (b[i] == max)
        cmax++;
      else if (b[i] == min)
        cmin++;
    }
    w = cmax * cmin;
  }
  printf("%lld %lld", max - min, w);
  free(b);
  return 0;
}
