#include <bits/stdc++.h>
using namespace std;
void read_file(bool outToFile = true) {}
int n;
int A[5000 + 9];
int tot;
int MIN[5000 + 9][5000 + 9];
void pre_pro() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == 0)
        MIN[i][j] = 0;
      else
        MIN[i][j] = MIN[i - 1][j];
      if (A[i] < j) MIN[i][j]++;
    }
  }
}
void calc() {
  tot = 0;
  for (int i = 0; i < n; i++) tot += MIN[n - 1][A[i]] - MIN[i][A[i]];
}
int query(int i, int j) {
  int s = (MIN[j - 1][A[i]] - MIN[i][A[i]]) - (MIN[j - 1][A[j]] - MIN[i][A[j]]);
  int ret = tot - 2 * s - 1;
  return ret;
}
int main() {
  read_file();
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; i++) scanf("%d", &A[i]);
    pre_pro();
    calc();
    int ans = tot, cnt = 0;
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        if (A[i] < A[j]) continue;
        int nw = query(i, j);
        if (nw < ans)
          ans = nw, cnt = 1;
        else if (nw == ans)
          cnt++;
      }
    }
    printf("%d %d\n", ans, cnt);
  }
}
