#include <bits/stdc++.h>
using namespace std;
int a[5100], f[5100][5100], g[5100][5100];
int n, m;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  memset(f, 0, sizeof(f));
  for (int i = 2; i <= n; i++)
    for (int j = 0; j < n; j++) f[i][j] = f[i - 1][j] + (a[i - 1] > j);
  for (int i = n - 1; i > 0; i--)
    for (int j = 0; j < n; j++) g[i][j] = g[i + 1][j] + (a[i + 1] < j);
  int ans = 0, num = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      int tmp = f[i][a[i]] + g[i][a[i]] + f[j][a[j]] + g[j][a[j]];
      tmp -= f[i][a[j]] + g[i][a[j]] + f[j][a[i]] + g[j][a[i]];
      tmp -= 1;
      if (tmp > ans)
        ans = tmp, num = 1;
      else if (tmp == ans)
        num++;
    }
  ans = -ans;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) ans += (a[i] > a[j]);
  printf("%d %d\n", ans, num);
  return 0;
}
