#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int N = 5005;
int n, tot, a[N], g[N][N];
map<int, int> cnt;
int main() {
  scanf("%d", &n);
  for (int i = (1); i < (n + 1); i++) scanf("%d", a + i);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      g[i][j] = g[i][j - 1];
      if (a[j] > a[i]) g[i][j]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j < i; j++)
      if (a[j] > a[i]) tot++;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int new_tot =
          tot + 2 * (g[i][j - 1] - g[i][i]) - 2 * (g[j][j - 1] - g[j][i]);
      if (a[i] > a[j]) new_tot--;
      cnt[new_tot]++;
    }
  }
  auto it = cnt.begin();
  printf("%d %d\n", it->first, it->second);
}
