#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 1;
int read() {
  int x;
  scanf("%d", &x);
  return x;
}
int a[N], b[N], n;
map<int, int> mp;
int tL[N], t[N];
int sum(int ind, int w[]) {
  int res = 0;
  for (int i = ind; i > 0; i = (i & (i - 1))) res += w[i];
  return res;
}
int sum(int L, int R, int w[]) {
  if (R < L) return 0;
  return sum(R, w) - sum(L - 1, w);
}
void inc(int ind, int delta, int w[]) {
  for (int i = ind; i <= n; i = (i | (i - 1)) + 1) w[i] += delta;
}
int d[N], cnt[30000000];
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    a[i]++;
  }
  int inv = 0;
  for (int i = 1; i <= n; i++) {
    d[i] = sum(a[i] + 1, n, tL);
    inv += d[i];
    inc(a[i], 1, tL);
  }
  int mini = 0, maxi = 0, minj = 0, maxj = 0, delta = 0;
  for (int i = 1; i < n; i++) {
    for (int i = 1; i <= n; i++) t[i] = 0;
    inc(a[i], 1, t);
    for (int j = i + 1; j <= n; j++) {
      inc(a[j], 1, t);
      mini = sum(a[i] - 1, t);
      maxi = sum(a[i] + 1, n, t);
      minj = sum(a[j] - 1, t);
      maxj = sum(a[j] + 1, n, t);
      delta = maxi - mini + minj - maxj + 1;
      if (delta < 0) cnt[-delta]++;
    }
  }
  int ans1 = inv, ans2 = 0;
  for (int i = inv; i >= 1; i--) {
    if (cnt[i]) {
      ans1 = inv - i;
      ans2 = cnt[i];
      break;
    }
  }
  cout << ans1 << " " << ans2 << endl;
}
