#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:200000000")
using namespace std;
const int MAXN = 1000001;
const int INF = 0x3f3f3f3f;
const long long INF_64 = (1LL << 62);
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int inv = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (a[i] > a[j]) inv++;
  int ans = INF, cnt = 0;
  vector<vector<int> > sum(n, vector<int>(n));
  for (int i = 0; i < n; i++) {
    int bigger = 0;
    for (int j = 0; j < n; j++) {
      if (a[i] > a[j]) bigger++;
      sum[i][j] = bigger;
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      int big_fr = sum[i][j];
      if (i) big_fr -= sum[i][i - 1];
      int big_sc = sum[j][j];
      big_sc -= sum[j][i];
      int len = j - i;
      int sml_fr = len - big_fr;
      len--;
      int sml_sc = len - big_sc;
      int cur = inv + sml_fr - big_fr - sml_sc + big_sc;
      if (cur < ans) {
        ans = cur;
        cnt = 1;
      } else if (cur == ans)
        cnt++;
    }
  cout << ans << ' ' << cnt;
}
