#include <bits/stdc++.h>
int main() {
  long long n, max, min, t, a, b, i;
  while (scanf("%lld ", &n) != EOF) {
    a = 0;
    b = 0;
    for (i = 0; i < n; i++) {
      scanf("%lld", &t);
      if (i == 0) {
        max = t;
        min = t;
      }
      if (max == t)
        a++;
      else if (t > max) {
        a = 1;
        max = t;
      }
      if (min == t)
        b++;
      else if (t < min) {
        b = 1;
        min = t;
      }
    }
    if (max == min)
      printf("0 %lld\n", n * (n - 1) / 2);
    else
      printf("%lld %lld\n", max - min, a * b);
  }
}
