#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  long long arr[n + 5];
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  long long mn = arr[0];
  long long mx = arr[n - 1];
  long long cnt1 = 0, cnt2 = 0;
  for (int i = 0; i < n; i++) {
    if (arr[i] == mn)
      cnt1++;
    else if (arr[i] == mx)
      cnt2++;
  }
  cout << mx - mn << " ";
  if (mn == mx)
    cout << n * 1LL * (n - 1) / 2;
  else
    cout << (long long)(cnt1 * cnt2);
  return 0;
}
