#include <bits/stdc++.h>
using namespace std;
int l2l[5005][5005], a[5005], s2r[5005][5005];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  int n, tot = 0;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    for (int j = 1; j < i; ++j) {
      if (a[j] > a[i]) {
        ++tot;
      }
    }
  }
  for (int i = 2; i <= n; ++i) {
    for (int j = 0; j < n; ++j) {
      l2l[i][j] = l2l[i - 1][j] + (a[i - 1] > j);
    }
  }
  for (int i = n - 1; i >= 1; --i) {
    for (int j = 0; j < n; ++j) {
      s2r[i][j] = s2r[i + 1][j] + (a[i + 1] < j);
    }
  }
  int cnt = 0, bSwaps = 1e9;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if (a[j] > a[i]) {
        continue;
      }
      int removeII = l2l[i][a[i]] + s2r[i][a[i]] - 1;
      int removeJJ = l2l[j][a[j]] + s2r[j][a[j]] - 1;
      int addIJ = l2l[j][a[i]] + s2r[j][a[i]];
      int addJI = l2l[i][a[j]] + s2r[i][a[j]];
      int nSwaps = tot - removeII - removeJJ + addIJ + addJI - 1;
      if (nSwaps < bSwaps) {
        bSwaps = nSwaps;
        cnt = 0;
      }
      if (nSwaps == bSwaps) {
        ++cnt;
      }
    }
  }
  cout << bSwaps << " " << cnt;
}
