#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(0);
  int n;
  cin >> n;
  int a[n + 2];
  for (int i = 1; i <= n; i++) {
    cin >> a[i], a[i]++;
  }
  int dp[n + 2][n + 2][2], ttl = 0;
  for (int i = 1; i <= n; i++) {
    dp[i][0][0] = dp[i][0][1] = 0;
    for (int j = 1; j <= n; j++) {
      dp[i][j][0] = (a[i] < a[j]) + dp[i][j - 1][0];
      dp[i][j][1] = (a[i] > a[j]) + dp[i][j - 1][1];
    }
    ttl += dp[i][i][0];
  }
  int res = ttl, cnt = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int tmp = ttl;
      tmp += (dp[i][j][0] - dp[i][i][0] - dp[i][j][1] + dp[i][i][1]);
      tmp += (dp[j][j][1] - dp[j][i - 1][1] - dp[j][j][0] + dp[j][i][0]);
      if (tmp < res) {
        res = tmp;
        cnt = 1;
      } else if (tmp == res) {
        cnt++;
      }
    }
  }
  cout << res << " " << cnt << "\n";
  return 0;
}
