#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 5100;
int n;
int aibi[MAX_N];
int aibj[MAX_N];
int v[MAX_N];
void update(int poz, int val, int aib[MAX_N]) {
  while (poz <= n) {
    aib[poz] += val;
    poz += (poz & -poz);
  }
}
int query(int poz, int aib[MAX_N]) {
  int sum = 0;
  while (poz) {
    sum += aib[poz];
    poz -= (poz & -poz);
  }
  return sum;
}
int cate;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
  }
  int ci = 0;
  int cost = 0;
  for (int i = 0; i < n; i++) {
    ci += (i - query(v[i] + 1, aibi));
    update(v[i] + 1, 1, aibi);
  }
  memset(aibi, 0, sizeof(aibi));
  for (int i = 0; i < n; i++) {
    memcpy(aibj, aibi, sizeof(aibi));
    update(v[i] + 1, 1, aibj);
    for (int j = i + 1; j < n; j++) {
      if (v[i] > v[j]) {
        int k = (query(v[i], aibj) - query(v[j], aibj)) -
                (query(v[i], aibi) - query(v[j], aibi));
        int c = ((i - query(v[i] + 1, aibi)) + (j - query(v[j] + 1, aibj))) -
                ((i - query(v[j] + 1, aibi)) + (j - query(v[i] + 1, aibj)) - k);
        if (c > cost) {
          cost = c;
          cate = 0;
        }
        if (c == cost) {
          cate++;
        }
      }
      update(v[j] + 1, 1, aibj);
    }
    update(v[i] + 1, 1, aibi);
  }
  printf("%d %d", ci - cost, cate);
}
