#include <bits/stdc++.h>
using namespace std;
void NITRO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long arr[200009];
int main() {
  NITRO();
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  cout << arr[n - 1] - arr[0] << " ";
  for (int i = 0; i < n - 1; i++) {
    if (arr[i] != arr[i + 1]) {
      long long ma = 0, mi = 0;
      for (int i = 0; i < n; i++) {
        if (arr[0] == arr[i])
          mi++;
        else
          break;
      }
      for (int i = n - 1; i > 0; i--) {
        if (arr[i] == arr[n - 1])
          ma++;
        else
          break;
      }
      cout << ma * mi;
      break;
    } else if (i == n - 2) {
      cout << n * (n - 1) / 2;
    }
  }
  return 0;
}
