#include <bits/stdc++.h>
using namespace std;
const int mx = 5000 + 10;
int a[mx];
int mins[mx][mx];
int majs[mx][mx];
int main() {
  int n, i, j;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (i = 0; i < n; i++) {
    mins[i][0] = majs[i][0] = 0;
    if (a[0] < i)
      mins[i][0]++;
    else if (a[0] > i)
      majs[i][0]++;
  }
  for (i = 0; i < n; i++) {
    for (j = 1; j < n; j++) {
      mins[i][j] = mins[i][j - 1];
      majs[i][j] = majs[i][j - 1];
      if (a[j] < i)
        mins[i][j]++;
      else if (a[j] > i)
        majs[i][j]++;
    }
  }
  int s = 0;
  for (i = 1; i < n; i++) {
    s += majs[a[i]][i - 1];
  }
  int smin = 1e8, scnt = 0, sn;
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      sn = s;
      if (i - 1 >= 0) {
        sn += majs[a[j]][i - 1] - majs[a[i]][i - 1];
      }
      sn += majs[a[i]][j - 1] - majs[a[j]][j - 1];
      if (a[j] > a[i]) sn++;
      if (j - 1 >= i + 1) {
        sn += mins[a[j]][j - 1] - mins[a[j]][i];
        sn -= mins[a[i]][j - 1] - mins[a[i]][i];
      }
      if (sn < smin) {
        smin = sn;
        scnt = 1;
      } else if (sn == smin) {
        scnt++;
      }
    }
  }
  printf("%d %d\n", smin, scnt);
  return 0;
}
