#include <bits/stdc++.h>
using namespace std;
const int N = 5010;
int dp[N][N];
int input[N];
long long n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> input[i];
  for (int i = 0; i < n; i++) {
    for (int j = n - 1; j >= 0; j--) {
      dp[i][j] = dp[i][j + 1] + (input[j] < i);
    }
  }
  int sum = 0;
  for (int i = 0; i < n - 1; i++)
    for (int j = i + 1; j < n; j++) {
      if (input[j] < input[i]) sum++;
    }
  int maxn;
  int ss;
  maxn = sum;
  ss = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < i; j++) {
      if (input[i] > input[j]) continue;
      int aa, bb, cc, dd, ns;
      aa = dp[input[i]][j] - dp[input[i]][i];
      dd = dp[input[j]][j] - dp[input[j]][i];
      bb = dd - aa;
      cc = (i - j - 1) - dd;
      ns = sum + aa - bb - (dd + 1);
      if (ns < maxn) {
        maxn = ns;
        ss = 1;
      } else if (ns == maxn) {
        ss++;
      }
    }
  }
  cout << maxn << " " << ss << endl;
  return 0;
}
