#include <bits/stdc++.h>
using namespace std;
int n, i, j, k, mk, mp, a[5010], b[5010][5010];
int main() {
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++)
    for (j = n - 1; j >= 0; j--) {
      b[i][j] = b[i][j + 1];
      if (a[i] > a[j]) b[i][j]++;
    }
  mk = 0;
  for (i = 0; i < n - 1; i++)
    for (j = i + 1; j < n; j++)
      if (a[i] > a[j]) {
        k = b[i][i] - b[i][j] - b[j][i] + b[j][j];
        k = 2 * k + 1;
        if (mk < k) {
          mk = k;
          mp = 1;
        } else if (mk == k)
          mp++;
      }
  mk = -mk;
  for (i = 0; i < n; i++) mk += b[i][i];
  cout << mk << " " << mp << endl;
  return 0;
}
