#include <bits/stdc++.h>
using namespace std;
int a[5500], b[5500], n;
void update(int x) {
  while (x <= n) {
    b[x]++;
    x += x & (-x);
  }
}
int query(int x) {
  int ans = 0;
  while (x) {
    ans += b[x];
    x -= x & (-x);
  }
  return ans;
}
int main() {
  scanf("%d", &n);
  int tot = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    a[i]++;
    tot += query(n) - query(a[i]);
    update(a[i]);
  }
  int ans = n * n;
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    memset(b, 0, sizeof(b));
    for (int j = i + 1; j <= n; ++j) {
      int sum = query(n);
      int r1 = query(a[i]);
      int r2 = query(a[j]);
      int res = tot - r1 + (sum - r1) - (sum - r2) + r2;
      if (a[j] < a[i]) res--;
      if (res < ans) {
        ans = res;
        cnt = 1;
      } else if (res == ans)
        cnt++;
      update(a[j]);
    }
  }
  printf("%d %d\n", ans, cnt);
  return 0;
}
