#include <bits/stdc++.h>
using namespace std;
int n, ar[5005], bit[5005];
void add(int i) {
  while (i > 0) {
    bit[i]++;
    i -= (i & (-i));
  }
}
int ask(int i) {
  int tmp = 0;
  while (i <= n) {
    tmp += bit[i];
    i += (i & (-i));
  }
  return tmp;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &ar[i]);
    ar[i]++;
  }
  long long old = 0, best = 0, pair = 0;
  for (int i = 1; i <= n; i++) {
    memset(bit, 0, sizeof(bit));
    for (int j = i + 1; j <= n; j++) {
      if (ar[i] < ar[j]) continue;
      old++;
      int dec = 1 + 2 * ask(ar[j]);
      if (dec > best)
        best = dec, pair = 1;
      else if (dec == best)
        pair++;
      add(ar[j]);
    }
  }
  printf("%I64d %I64d\n", old - best, pair);
  return 0;
}
