#include <bits/stdc++.h>
using namespace std;
const int max_n = 5011, inf = 1e9 + 100;
int cnt_more[max_n][max_n];
int m[max_n];
int n;
int init = 0;
int ans = inf;
int cnt = 0;
void upd(int l, int r, int cmr) {
  int cml = cnt_more[l][r - 1];
  int curans = init;
  if (m[l] < m[r]) {
    ++curans;
  } else {
    --curans;
  }
  int len = r - l + 1;
  curans += cml;
  curans -= cmr;
  curans -= (len - cml);
  curans += (len - cmr);
  if (curans < ans) {
    ans = curans;
    cnt = 1;
  } else if (curans == ans) {
    ++cnt;
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> m[i];
  }
  for (int i = 0; i < n; ++i) {
    int cm = 0;
    for (int j = i + 1; j < n; ++j) {
      if (m[j] > m[i]) {
        ++cm;
      }
      cnt_more[i][j] = cm;
    }
  }
  for (int i = 0; i < n; ++i) {
    init += (n - i - 1 - cnt_more[i][n - 1]);
  }
  for (int i = n - 1; i > 0; --i) {
    int cm = 0;
    for (int j = i - 1; j >= 0; --j) {
      upd(j, i, cm);
      if (m[j] > m[i]) {
        ++cm;
      }
    }
  }
  cout << ans << ' ' << cnt << endl;
  return 0;
}
