#include <bits/stdc++.h>
using namespace std;
int n;
int dp[5005][5005];
int a[5005], inv;
int kol;
int calc(int l, int r, int val) {
  if (l) return dp[r][val] - dp[l - 1][val];
  return dp[r][val];
}
int up(int l, int r, int val) { return r - l + 1 - calc(l, r, val); }
int main() {
  cin >> 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++) inv += a[i] > a[j];
  }
  for (int i = 0; i < n; i++) {
    dp[i][a[i] + 1] = 1;
    for (int j = 1; j < n; j++) dp[i][j] += dp[i][j - 1];
    for (int j = 0; j < n; j++) {
      if (i) dp[i][j] += dp[i - 1][j];
    }
  }
  int ans = 1e9;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (a[i] > a[j]) {
        int cur = calc(i + 1, j - 1, a[j]) + up(i + 1, j - 1, a[i]) - 1 -
                  calc(i + 1, j - 1, a[i]) - up(i + 1, j - 1, a[j]);
        if (ans > cur) {
          ans = cur;
          cnt = 1;
        } else if (ans == cur)
          cnt++;
      }
    }
  }
  cout << inv + ans << ' ' << cnt;
}
