#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;
const int N = 5010;
int bit[N];
void add(int i, int x) {
  for (; i < N; i += i & -i) bit[i] += x;
}
int sum(int i) {
  int res = 0;
  for (; i; i -= i & -i) res += bit[i];
  return res;
}
int n, a[N];
int main() {
  cin >> n;
  for (int i = 0; i < (int)n; i++) cin >> a[i], a[i]++;
  int ans = 0, num = 0;
  for (int i = 0; i < (int)n; i++) {
    memset(bit, 0, sizeof(bit));
    for (int j = i + 1; j < n; j++) {
      int cnt = (a[i] > a[j] ? 1 : -1);
      cnt += 2 * (sum(a[i]) - sum(a[j]));
      if (cnt > ans) ans = cnt, num = 0;
      if (cnt == ans) num++;
      add(a[j], 1);
    }
  }
  ans *= -1;
  for (int j = 0; j < (int)n; j++)
    for (int i = 0; i < (int)j; i++)
      if (a[i] > a[j]) ans++;
  cout << ans << " " << num << endl;
  return 0;
}
