#include <bits/stdc++.h>
int main(int argc, char** argv) {
  long long n;
  std::cin >> n;
  long long min, max;
  min = LLONG_MAX;
  max = LLONG_MIN;
  long long count_min{}, count_max{};
  for (long long i{}; i < n; i++) {
    int b;
    std::cin >> b;
    if (b > max) {
      max = b;
      count_max = 1;
    } else if (b == max) {
      count_max++;
    }
    if (b < min) {
      min = b;
      count_min = 1;
    } else if (b == min) {
      count_min++;
    }
  }
  if (min == max) {
    std::cout << max - min << " " << (count_min) * (count_min - 1) / 2;
  } else {
    std::cout << max - min << " " << count_min * count_max;
  }
  return 0;
}
