#include <bits/stdc++.h>
const int maxn = 5000 + 10;
using namespace std;
int a[maxn];
int c[maxn];
int cnt[maxn][maxn];
int n;
void update(int idx, int val) {
  while (idx <= n) {
    c[idx] += val;
    idx += idx & -idx;
  }
}
int getsum(int idx) {
  int sum = 0;
  while (idx > 0) {
    sum += c[idx];
    idx -= idx & -idx;
  }
  return sum;
}
void print(int v[][maxn]) {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) cout << v[i][j] << " ";
    cout << endl;
  }
}
int main() {
  while (scanf("%d", &n) != EOF) {
    memset(c, 0, sizeof(c));
    memset(cnt, 0, sizeof(cnt));
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      a[i] += 1;
      update(a[i], 1);
      ans += i - getsum(a[i]);
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (a[i] < j)
          cnt[i][j] = cnt[i - 1][j] + 1;
        else
          cnt[i][j] = cnt[i - 1][j];
      }
    }
    int ways = 0;
    int ans_copy = ans;
    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        int num_l_ai = cnt[j][a[i]] - cnt[i][a[i]];
        int num_g_ai = j - i - num_l_ai;
        int num_l_aj = cnt[j][a[j]] - cnt[i][a[j]];
        int num_g_aj = j - i - 1 - num_l_aj;
        int tmp = ans_copy - num_l_ai + num_g_ai + num_l_aj - num_g_aj;
        if (tmp < ans) {
          ans = tmp;
          ways = 1;
        } else if (tmp == ans)
          ways++;
      }
    }
    printf("%d %d\n", ans, ways);
  }
  return 0;
}
