#include <bits/stdc++.h>
using namespace std;
int n;
int d[5001];
int inv[5001];
int totInv;
int ret;
int retCnt;
int lcntGE[5007][5007];
int rcntLE[5007][5007];
void solution() {
  scanf("%d", &n);
  for (int i = 0, _n = (n); i < _n; ++i) scanf("%d", d + i);
  for (int i = 0, _n = (n); i < _n; ++i)
    for (int j = i + 1; j < n; j++)
      if (d[i] > d[j]) {
        inv[i]++;
        inv[j]++;
        totInv++;
      }
  for (int i = 0; i <= d[0]; i++) lcntGE[0][i] = 1;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= 5003; j++) lcntGE[i][j] = lcntGE[i - 1][j];
    for (int j = 0; j <= d[i]; j++) lcntGE[i][j]++;
  }
  for (int i = d[n - 1]; i <= 5003; i++) rcntLE[n - 1][i] = 1;
  for (int i = n - 2; i >= 0; i--) {
    for (int j = 0; j <= 5003; j++) rcntLE[i][j] = rcntLE[i + 1][j];
    for (int j = d[i]; j <= 5003; j++) rcntLE[i][j]++;
  }
  ret = 0x7f7f7f7f;
  for (int i = 0, _n = (n); i < _n; ++i)
    for (int j = i + 1; j < n; j++) {
      int curInv = totInv;
      curInv -= inv[i];
      curInv -= inv[j];
      curInv++;
      if (j) curInv += lcntGE[j - 1][d[i] + 1];
      if (d[i]) curInv += rcntLE[j + 1][d[i] - 1];
      if (i) curInv += lcntGE[i - 1][d[j] + 1];
      if (d[j]) curInv += rcntLE[i + 1][d[j] - 1];
      if (curInv == ret)
        retCnt++;
      else if (curInv < ret) {
        ret = curInv;
        retCnt = 1;
      }
    }
  if (ret == 0x7f7f7f7f) throw 1;
  printf("%d %d\n", ret, retCnt);
}
int main() {
  solution();
  return 0;
}
