#include <bits/stdc++.h>
using namespace std;
int lft[5007][5007], rht[5007][5007];
int a[5007];
int main() {
  int n, ans, l, r;
  ans = -(1 << 30);
  cin >> n;
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  for (int i = 1; i <= n; ++i) {
    int j = i - 1, c = 0;
    while (j >= 1) {
      if (a[j] > a[i]) ++c;
      lft[i][j] = c;
      --j;
    }
    j = i + 1, c = 0;
    while (j <= n) {
      if (a[j] > a[i]) ++c;
      rht[i][j] = c;
      ++j;
    }
  }
  int sum = 0;
  for (int i = 2; i <= n; ++i) sum += lft[i][1];
  int cnt = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) {
      int tmp = lft[j][i + 1] - (j - i - 1 - lft[j][i + 1]) + j - i - 1 -
                2 * rht[i][j - 1];
      if (a[j] < a[i])
        tmp++;
      else
        tmp--;
      if (tmp > ans) {
        ans = tmp, l = i, r = j;
        cnt = 1;
      } else if (tmp == ans)
        ++cnt;
    }
  printf("%d %d\n", sum - ans, cnt);
}
