#include <bits/stdc++.h>
using namespace std;
int a[1000001];
int t[1000001];
int d[5005][5005];
int n;
int sum(int ind) {
  int res = 0;
  for (int i = ind; i > 0; i = (i & (i - 1))) {
    res += t[i];
  }
  return res;
}
void update(int ind, int delta) {
  for (int i = ind; i <= n; i = (i | (i - 1)) + 1) t[i] += delta;
}
int sum(int L, int R) { return sum(R) - sum(L - 1); }
int main() {
  int res = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i]++;
    update(a[i], 1);
    res += sum(a[i] + 1, n);
  }
  int mx = LONG_LONG_MIN;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) t[j] = 0;
    update(a[i], 1);
    for (int j = i + 1; j <= n; j++) {
      update(a[j], 1);
      d[i][j] = -sum(1, a[j]) - sum(a[i], n) + sum(a[j], n) + sum(1, a[i]) - 1;
      mx = max(mx, d[i][j]);
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (d[i][j] == mx) ans++;
    }
  }
  cout << res - mx << " " << ans;
}
