#include <bits/stdc++.h>
int main() {
  int n;
  int input;
  int max = 0;
  int min = -1;
  int max_counter;
  int min_counter;
  int difference;
  int i;
  int ans;
  while ((scanf("%d", &n)) != EOF) {
    for (i = 0; i < n; i++) {
      scanf("%d", &input);
      if (min == -1) {
        min = input;
        min_counter = 1;
      } else if (input < min) {
        min = input;
        min_counter = 1;
      } else if (input == min) {
        min_counter++;
      }
      if (input > max) {
        max = input;
        max_counter = 1;
      } else if (max == input) {
        max_counter++;
      }
    }
    if (max == min) {
      printf("0 %lld\n",
             (long long)max_counter * (long long)(min_counter - 1) / 2);
    } else {
      printf("%d %lld\n", max - min,
             (long long)max_counter * (long long)min_counter);
    }
    max = 0;
    min = -1;
    min_counter = 1;
    max_counter = 1;
  }
  return 0;
}
