#include <bits/stdc++.h>
using namespace std;
vector<int> iin(int n) {
  vector<int> x;
  for (int i = 0; i < n; i++) {
    int y;
    cin >> y;
    x.push_back(y);
  }
  return x;
}
vector<long long> illv(long long n) {
  vector<long long> x;
  for (long long i = 0; i < n; i++) {
    long long y;
    cin >> y;
    x.push_back(y);
  }
  return x;
}
void div(vector<int> x) {
  for (auto i : x) cout << i << " ";
  cout << "\n";
}
void dllv(vector<long long> x) {
  for (auto i : x) cout << i << " ";
  cout << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long m, a, b, c = 0, d = 0;
  cin >> m;
  vector<long long> x;
  x = illv(m);
  a = *max_element(x.begin(), x.end());
  b = *min_element(x.begin(), x.end());
  for (long long i = 0; i < m; i++) {
    if (x[i] == a) c++;
    if (x[i] == b) d++;
  }
  cout << a - b << " " << (a == b ? m * (m - 1) / 2 : c * d);
}
