#include <bits/stdc++.h>
using namespace std;
int bigger[5010][5010], smaller[5010][5010], n;
int noSwaps(int a[]);
int main() {
  int arr[5010], temp[5010];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  for (int i = 0; i < n; i++) {
    temp[i] = arr[i];
    if (arr[i] > arr[0])
      smaller[arr[i]][0] = 1;
    else
      smaller[arr[i]][0] = 0;
    if (arr[i] < arr[0])
      bigger[arr[i]][0] = 1;
    else
      bigger[arr[i]][0] = 0;
    for (int j = 1; j < n; j++) {
      smaller[arr[i]][j] = smaller[arr[i]][j - 1];
      bigger[arr[i]][j] = bigger[arr[i]][j - 1];
      if (arr[i] > arr[j]) smaller[arr[i]][j]++;
      if (arr[i] < arr[j]) bigger[arr[i]][j]++;
    }
  }
  int minS = noSwaps(temp), count = 0, initial = minS;
  if (!noSwaps) {
    printf("0 0");
    return 0;
  }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      if (arr[i] < arr[j]) continue;
      int swaps = initial - smaller[arr[i]][j] + bigger[arr[i]][j] +
                  smaller[arr[j]][j] - bigger[arr[j]][j] + 1;
      if (i > 0)
        swaps += smaller[arr[i]][i - 1] - bigger[arr[i]][i - 1] -
                 smaller[arr[j]][i - 1] + bigger[arr[j]][i - 1];
      if (minS == swaps)
        count++;
      else if (minS > swaps) {
        minS = swaps;
        count = 1;
      }
    }
  printf("%d %d", minS, count);
  return 0;
}
int noSwaps(int a[]) {
  int swaps = 0;
  for (int i = 1; i < n; i++) {
    int j = i - 1, key = a[i];
    while (j >= 0 && a[j] > key) {
      swaps++;
      a[j + 1] = a[j--];
    }
    a[j + 1] = key;
  }
  return swaps;
}
