#include <bits/stdc++.h>
using namespace std;
long long int a[5001], dp[5001][5001];
int main() {
  long long int i, j, n, ways = 0, mini = 1000000000000, cur, tot = 0;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) dp[i][j] = dp[i][j - 1] + (a[i] > a[j]);
    for (j = i - 1; j >= 0; j--) dp[i][j] = dp[i][j + 1] + (a[i] > a[j]);
    tot += dp[i][n - 1];
  }
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      if (a[i] > a[j]) {
        cur = tot - 2 * (dp[i][j - 1] - dp[j][i + 1]) - 1;
        if (cur < mini) {
          mini = cur;
          ways = 1;
        } else if (cur == mini)
          ways++;
      }
    }
  }
  cout << mini << " " << ways;
  return 0;
}
