#include <bits/stdc++.h>
using namespace std;
int c[5005], a[5005], n;
int lowbit(int x) { return x & (-x); }
void add(int x) {
  for (int i = x; i <= n; i += lowbit(i)) ++c[i];
}
int get(int x) {
  int ret = 0;
  for (int i = x; i; i -= lowbit(i)) ret += c[i];
  return ret;
}
int cal() {
  int ret = 0;
  memset(c, 0, sizeof(c));
  for (int i = 0; i < n; ++i) {
    ret += i - get(a[i]);
    add(a[i]);
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    ++a[i];
  }
  int tot = cal();
  int ans1 = tot, ans2 = 1, now1, now2, now;
  for (int i = 1; i < n; ++i) {
    memset(c, 0, sizeof(c));
    for (int j = i - 1; j >= 0; --j) {
      now1 = get(a[j]);
      now2 = get(a[i]);
      now = tot + 2 * now2 - 2 * now1;
      a[i] < a[j] ? --now : ++now;
      if (now < ans1) {
        ans1 = now;
        ans2 = 1;
      } else if (now == ans1)
        ++ans2;
      add(a[j]);
    }
  }
  printf("%d %d\n", ans1, ans2);
}
