#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000 + 10;
int a[maxn];
int dp[maxn][maxn];
int dp1[maxn][maxn];
int n, ans, cnt, inv;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      if (a[j] > a[i])
        dp[i][j] = dp[i][j - 1] + 1;
      else
        dp[i][j] = dp[i][j - 1];
    }
  for (int i = n; i > 0; i--)
    for (int j = n; j > 0; j--) {
      if (a[j] < a[i])
        dp1[i][j] = dp1[i][j + 1] + 1;
      else
        dp1[i][j] = dp1[i][j + 1];
    }
  for (int i = 1; i <= n; i++)
    for (int j = i - 1; j > 0; j--)
      if (a[i] < a[j]) inv++;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (a[i] > a[j]) {
        int inv1 = dp1[i][i] + dp[j][j] + dp[i][i] + dp1[j][j];
        int inv2 = dp1[j][i] + dp[j][i - 1] + dp1[i][j + 1] + dp[i][j] + 1;
        if (inv1 > inv2) {
          if (inv1 - inv2 > ans) {
            ans = inv1 - inv2;
            cnt = 1;
          } else if (inv1 - inv2 == ans)
            cnt++;
        }
      }
  cout << inv - ans << " " << cnt;
}
