#include <bits/stdc++.h>
using namespace std;
const int N = 5555;
int n, m;
int f[N][N];
int f2[N][N];
int main() {
  int n;
  scanf("%d", &n);
  int v[N];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &v[i]);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < n; j++) {
      f[i][j] = f[i - 1][j] + (v[i] < j);
      f2[i][j] = f2[i - 1][j] + (v[i] > j);
    }
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= i; j++) {
      if (v[j] > v[i]) cnt++;
    }
  }
  int mx = 1 << 30, mxn = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (v[i] > v[j]) {
        int k1 = f[j - 1][v[i]] - f[i - 1][v[i]];
        int k2 = f[j - 1][v[j]] - f[i - 1][v[j]];
        int k3 = f2[j - 1][v[j]] - f2[i - 1][v[j]];
        int k4 = f2[j - 1][v[i]] - f2[i - 1][v[i]];
        int d = k2 - k1 + k4 - k3;
        if (mx > d) {
          mx = d;
          mxn = 0;
        }
        if (mx == d) mxn++;
      }
    }
  }
  printf("%d %d", cnt + mx, mxn);
  return 0;
}
