#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
int q[N][N], h[N][N], a[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i]++;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 2; j <= n; j++) {
      q[i][j] = q[i][j - 1] + (a[j - 1] > i);
    }
    for (int j = n - 1; j >= 1; j--) {
      h[i][j] = h[i][j + 1] + (a[j + 1] < i);
    }
  }
  int mx = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j < i; j++) {
      if (a[i] < a[j]) mx++;
    }
  }
  int ans1 = mx, ans2 = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int res = mx - q[a[i]][i] - q[a[j]][j] + q[a[j]][i] + q[a[i]][j] -
                h[a[i]][i] - h[a[j]][j] + h[a[j]][i] + h[a[i]][j] + 1;
      if (res < ans1) {
        ans1 = res;
        ans2 = 1;
      } else if (res == ans1) {
        ans2++;
      }
    }
  }
  printf("%d %d\n", ans1, ans2);
  return 0;
}
