#include <bits/stdc++.h>
using namespace std;
const int maxn = 5005;
int p[maxn], tr[maxn], s1[maxn][maxn], s2[maxn][maxn];
inline int getsum(int x) {
  int r = 0;
  while (x) {
    r += tr[x];
    x -= x & -x;
  }
  return r;
}
int main(int argc, char const *argv[]) {
  int n;
  scanf("%d", &n);
  for (int(i) = (int)(1); (i) <= (int)(n); ++(i)) scanf("%d", p + i), ++p[i];
  int r1 = 0;
  for (int(i) = (int)(1); (i) <= (int)(n); ++(i)) {
    r1 += getsum(n) - getsum(p[i]);
    for (int x = p[i]; x <= n; x += x & -x) tr[x] += 1;
  }
  for (int(i) = (int)(1); (i) <= (int)(n); ++(i))
    for (int(j) = (int)(1); (j) <= (int)(n); ++(j))
      s1[i][j] = p[j] > i, s2[i][j] = p[j] < i;
  for (int(i) = (int)(1); (i) <= (int)(n); ++(i))
    for (int(j) = (int)(1); (j) <= (int)(n); ++(j))
      s1[i][j] += s1[i][j - 1], s2[i][j] += s2[i][j - 1];
  int r = (int)1e9, big1 = -1, big2 = -1, rc = 0;
  for (int(i) = (int)(1); (i) <= (int)(n); ++(i))
    for (int(j) = (int)(i + 1); (j) <= (int)(n); ++(j)) {
      int r2 = r1;
      r2 -= s2[p[i]][j] - s2[p[i]][i];
      r2 += s1[p[i]][j] - s1[p[i]][i];
      r2 -= s1[p[j]][j - 1] - s1[p[j]][i - 1];
      r2 += s2[p[j]][j - 1] - s2[p[j]][i - 1];
      r2 += p[i] > p[j];
      r = min(r, r2);
      if (big1 == -1 || r2 < big1)
        big2 = big1, big1 = r2, rc = 1;
      else if (r2 == big1)
        ++rc;
      else if (big2 == -1 || r2 < big2)
        big2 = r2;
    }
  printf("%d %d\n", r, rc);
  return 0;
}
