#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int n;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  vector<long long int> vals;
  cin >> n;
  long long int x_min = LLONG_MAX;
  long long int x_max = 0;
  while (n--) {
    long long int x;
    cin >> x;
    vals.push_back(x);
    x_min = min(x_min, x);
    x_max = max(x_max, x);
  }
  long long int min_count = 0;
  long long int max_count = 0;
  for (long long int x : vals) {
    if (x == x_max) max_count++;
    if (x == x_min) min_count++;
  }
  long long int ways;
  if (x_max == x_min) {
    ways = max_count * (max_count - 1) / 2;
  } else {
    ways = min_count * max_count;
  }
  cout << (x_max - x_min) << ' ' << ways << '\n';
  return 0;
}
