#include <bits/stdc++.h>
using namespace std;
const int N = 5000;
int n, p[N], f[N];
int sum(int r) {
  int res = 0;
  while (r >= 0) {
    res += f[r];
    r = (r & (r + 1)) - 1;
  }
  return res;
}
void add(int pos, int val) {
  while (pos < n) {
    f[pos] += val;
    pos |= (pos + 1);
  }
}
int main() {
  int was = 0, ans = 0, cnt = 0;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < i; j++) was += p[j] > p[i];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) f[j] = 0;
    for (int j = i + 1; j < n; j++) {
      int a = sum(p[i]);
      int b = sum(p[j]);
      int d = 2 * b - 2 * a - (p[i] > p[j]);
      if (d == ans)
        cnt++;
      else if (d < ans) {
        ans = d;
        cnt = 1;
      }
      add(p[j], 1);
    }
  }
  cout << was + ans << ' ' << cnt << endl;
  return 0;
}
