#include <bits/stdc++.h>
using namespace std;
int f[5005][5005];
int b[5005][5005];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  memset(f, 0, sizeof(f));
  memset(b, 0, sizeof(b));
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int inv = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      f[i][j] = f[i][j - 1];
      if (a[j] < a[i]) {
        f[i][j]++;
      }
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = i - 1; j >= 0; j--) {
      b[i][j] = b[i][j + 1];
      if (a[j] < a[i]) {
        b[i][j]++;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (a[j] < a[i]) {
        inv++;
      }
    }
  }
  int maxa = inv;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (a[j] > a[i]) {
        continue;
      }
      int lol = inv - f[i][j];
      lol++;
      lol += b[j][i];
      lol -= (j - i - b[j][i]);
      lol += (j - i - f[i][j]);
      maxa = min(maxa, lol);
    }
  }
  int op = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (a[j] > a[i]) {
        continue;
      }
      int lol = inv - f[i][j];
      lol += b[j][i];
      lol++;
      lol -= (j - i - b[j][i]);
      lol += (j - i - f[i][j]);
      if (lol == maxa) {
        op++;
      }
    }
  }
  cout << maxa << " " << op;
}
