#include <bits/stdc++.h>
using namespace std;
int precal[5005][5005], ara[5005];
int main() {
  int i, j, n, init = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &ara[i]);
  for (i = 1; i < n; i++) {
    int cnt = 0, c1 = 0;
    for (j = i - 1; j >= 0; j--) {
      cnt += (ara[j] < ara[i]);
      c1 += (ara[j] < ara[i]);
      c1 -= (ara[i] < ara[j]);
      precal[j][i] = c1;
    }
    init += (i - cnt);
  }
  int ans = 0, tot = 0;
  for (i = 0; i < n; i++) {
    int cnt = 0;
    for (j = i + 1; j < n; j++) {
      cnt += (ara[j] < ara[i]);
      cnt -= (ara[j] > ara[i]);
      if (cnt - precal[i][j] - (ara[i] > ara[j]) > ans) {
        ans = cnt - precal[i][j] - (ara[i] > ara[j]);
        tot = 1;
      } else if (cnt - precal[i][j] - (ara[i] > ara[j]) == ans)
        tot++;
    }
  }
  cout << init - ans << " " << tot << endl;
  return 0;
}
