#include <bits/stdc++.h>
using namespace std;
int main(void) {
  vector<long long> input;
  long long in, a;
  cin >> a;
  while (a--) {
    cin >> in;
    input.push_back(in);
  }
  sort(input.begin(), input.end());
  long long temp1 = input[0], temp2 = input[input.size() - 1];
  long long counter1 = 0, counter2 = 0;
  long long d = 0;
  while (input[d] == temp1) {
    d++;
    counter1++;
  }
  d = input.size() - 1;
  if (counter1 == d + 1) {
    cout << 0 << " " << (d * (d + 1) / 2) << endl;
    return 0;
  }
  while (input[d] == temp2) {
    d--;
    counter2++;
  }
  cout << temp2 - temp1 << " " << counter1 * counter2 << endl;
  return 0;
}
