#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
const int MAX = 5005;
int n;
int arr[MAX];
int L[MAX][MAX], R[MAX][MAX];
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); ++i) {
    scanf("%d", &arr[i]);
  }
  for (int i = (0); i <= (n - 1); ++i) {
    for (int j = (0); j <= (n - 1); ++j) {
      L[i][j] = (j > 0 ? L[i][j - 1] : 0) + (arr[j] > arr[i]);
    }
  }
  for (int i = (n - 1); i >= (0); --i) {
    for (int j = (n - 1); j >= (0); --j) {
      R[i][j] = (j < n - 1 ? R[i][j + 1] : 0) + (arr[i] > arr[j]);
    }
  }
  int actual = 0;
  for (int i = (1); i < (n); ++i) {
    for (int j = (i - 1); j >= (0); --j) {
      if (arr[j] > arr[i]) ++actual;
    }
  }
  int best = 0, count = 0;
  for (int i = (0); i < (n - 1); ++i) {
    for (int j = (i + 1); j < (n); ++j) {
      if (arr[i] > arr[j]) {
        ;
        int diff = (R[i][i + 1] - R[i][j]) + (L[j][j - 1] - L[j][i]) + 1;
        diff -= (R[j][i + 1] - R[j][j]) + (L[i][j - 1] - L[i][i]);
        if (diff > best) {
          best = diff;
          count = 1;
        } else if (diff == best) {
          ++count;
        }
      }
    }
  }
  printf("%d %d\n", actual - best, count);
  return 0;
}
