#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n];
  long long int f[100005];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  int x = a[n - 1] - a[0];
  long long int y = 1;
  int i = 1;
  while (a[i] == a[0] && i < n - 1) {
    y++;
    i++;
  }
  i = n - 2;
  long long int z = 1;
  while (a[i] == a[n - 1] && i > 0) {
    z++;
    i--;
  }
  if (a[n - 1] == a[0]) {
    cout << x << " " << (n * (n - 1)) / 2;
    exit(0);
  }
  cout << x << " " << z * y << endl;
}
