#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5005;
int N, tot, res = 1e8, cnt;
int ar[MAXN];
int dn[MAXN][MAXN];
int main() {
  scanf(" %d", &N);
  for (int i = 1; i <= N; i++) scanf(" %d", ar + i);
  for (int i = 1; i <= N; i++) {
    for (int j = i + 1; j <= N; j++) dn[i][j] = dn[i][j - 1] + (ar[j] < ar[i]);
    for (int j = i - 1; j; j--) dn[i][j] = dn[i][j + 1] + (ar[j] < ar[i]);
    tot += dn[i][N];
  }
  for (int i = 1; i < N; i++)
    for (int j = i + 1; j <= N; j++)
      if (ar[j] < ar[i]) {
        int cur = tot - 2 * (dn[i][j - 1] - dn[j][i + 1]) - 1;
        if (cur < res) {
          res = cur;
          cnt = 1;
        } else if (cur == res)
          cnt++;
      }
  printf("%d %d\n", res, cnt);
  return 0;
}
