#include <bits/stdc++.h>
using namespace std;
const int N = 5555;
int a[N], n, tree[N], ans, cnt;
void update(int idx) {
  while (idx < N) {
    tree[idx]++;
    idx += idx & -idx;
  }
}
int f(int idx) {
  int res = 0;
  while (idx) {
    res += tree[idx];
    idx -= idx & -idx;
  }
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    a[i]++;
  }
  int vafshe = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) vafshe += a[j] < a[i];
  ans = vafshe + 1;
  cnt = 0;
  for (int i = 0; i < n; i++) {
    memset(tree, 0, sizeof(tree));
    update(a[i]);
    for (int j = i + 1; j < n; j++) {
      update(a[j]);
      int x = f(a[i] - 1);
      int y = f(a[j] - 1);
      int tmp = vafshe - x + (j - i - x) + y - (j - i - y) + 1;
      if (tmp <= ans) {
        if (tmp < ans)
          cnt = 1;
        else
          cnt++;
        ans = tmp;
      }
    }
  }
  printf("%d %d", ans, cnt);
  return 0;
}
