#include <bits/stdc++.h>
using namespace std;
const int qq = 5e3 + 10;
int dp[qq][qq];
int num[qq];
int position[qq];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", num + i);
    position[num[i]] = i;
  }
  for (int i = 0; i < n; ++i)
    for (int j = n - 1; j >= 0; --j) {
      if (num[j] < i) dp[i][j]++;
      dp[i][j] += dp[i][j + 1];
    }
  int sum = 0;
  for (int i = 0; i < n; ++i) sum += dp[i][position[i]];
  int maxn = sum;
  int k = 1;
  for (int j, i = 0; i < n; ++i)
    for (j = 0; j < i; ++j) {
      int aa = dp[num[i]][j + 1] - dp[num[i]][i];
      int dd = dp[num[j]][j + 1] - dp[num[j]][i];
      int cc = (i - j - 1) - dd;
      int ns;
      if (num[i] > num[j])
        ns = sum + aa + cc + 1 - (2 * (i - j - 1) - aa - cc);
      else
        ns = sum + aa + cc - (2 * (i - j - 1) - aa - cc + 1);
      if (ns < maxn) {
        maxn = ns;
        k = 1;
      } else if (maxn == ns)
        ++k;
    }
  printf("%d %d\n", maxn, k);
  return 0;
}
