#include <bits/stdc++.h>
using namespace std;
const int N = 5010;
int n, a[N];
int p[N][N], sum;
inline int get(int x, int l, int r) { return p[x][r] - p[x][l - 1]; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (a[j] > a[i])
        p[i][j] = p[i][j - 1] + 1;
      else
        p[i][j] = p[i][j - 1];
    }
    sum += p[i][i - 1];
  }
  int mx = sum, cnt = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j < i; ++j) {
      int cur = sum - get(j, 1, j - 1) - (i - j - 1 - get(j, j + 1, i - 1)) -
                get(i, 1, i - 1) + get(i, 1, j - 1) +
                (i - j - 1 - get(i, j + 1, i - 1)) + get(j, 1, i - 1) +
                (a[i] > a[j]);
      if (cur == mx)
        cnt++;
      else if (cur < mx)
        mx = cur, cnt = 1;
    }
  }
  printf("%d %d\n", mx, cnt);
  return 0;
}
