#include <bits/stdc++.h>
using namespace std;
int n, a[5000], h[5000][5000], best = 1000000000, bestn, old = 0;
int main() {
  memset(h, 0, sizeof(h));
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < n; j++) {
      h[i][j] = h[i - 1][j];
      if (a[i - 1] > a[j]) h[i][j]++;
    }
    old += h[i][i];
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < i; j++) {
      int curr = old - h[i][i] + h[j][i] + i - h[i][i] - j + h[j][i];
      curr += h[i][j] - h[j][j] - i + h[i][j] + j - h[j][j] + 1;
      if (curr == best) bestn++;
      if (curr < best) {
        best = curr;
        bestn = 1;
      }
    }
  }
  cout << best << " " << bestn;
}
