#include <bits/stdc++.h>
using namespace std;
const int N = 5002;
int dp[N][N], n, arr[N];
int op = 1e9, st, cnt;
vector<pair<int, int> > out;
int get(int i, int j, int s, int e) {
  return dp[j][e] - dp[j][s - 1] - (dp[i - 1][e] - dp[i - 1][s - 1]);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &arr[i]), arr[i]++;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) dp[i][j] = dp[i - 1][j];
    for (int j = arr[i]; j <= n; j++) dp[i][j]++;
    st += i - dp[i][arr[i]];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int d =
          get(i + 1, j - 1, 1, arr[j] - 1) - get(i + 1, j - 1, 1, arr[i] - 1);
      d -= get(1, i - 1, arr[i] + 1, n);
      d -= get(1, j - 1, arr[j] + 1, n);
      d += get(1, i - 1, arr[j] + 1, n);
      d += get(1, j - 1, arr[i] + 1, n);
      d += (arr[j] > arr[i]);
      if (d < op) op = d, cnt = 0;
      if (d == op) cnt++;
    }
  }
  cout << st + op << " " << cnt << endl;
}
