#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000 + 5;
const int INF = 1 << 30;
int a[maxn], sum[maxn][maxn], sum2[maxn][maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    sum[i][i] = 0;
    for (int j = i + 1; j < n; j++) {
      sum[i][j] = sum[i][j - 1];
      if (a[j] < a[i]) sum[i][j]++;
    }
    sum2[i][i] = 0;
    for (int j = i - 1; j >= 0; j--) {
      sum2[i][j] = sum2[i][j + 1];
      if (a[i] > a[j]) sum2[i][j]++;
    }
  }
  int tot = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++)
      if (a[i] > a[j]) tot++;
  }
  int mn = INF, ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int cur =
          tot + (j - i) - 2 * sum[i][j - 1] + 2 * sum2[j][i + 1] - (j - i);
      if (a[i] > a[j])
        cur--;
      else
        cur++;
      if (cur < mn) {
        mn = cur;
        ans = 1;
      } else if (cur == mn)
        ans++;
    }
  }
  printf("%d %d\n", mn, ans);
  return 0;
}
