#include <bits/stdc++.h>
using namespace std;
int n, arr[5001];
int dp[5001][5001];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) {
    dp[i][i] = 0;
    for (int j = i - 1; j >= 0; j--)
      if (arr[j] > arr[i])
        dp[i][j] = dp[i][j + 1] + 1;
      else
        dp[i][j] = dp[i][j + 1];
    for (int j = i + 1; j < n; j++)
      if (arr[j] > arr[i])
        dp[i][j] = dp[i][j - 1] + 1;
      else
        dp[i][j] = dp[i][j - 1];
  }
  int inversions = 0;
  for (int i = 0; i < n - 1; i++)
    for (int j = i + 1; j < n; j++)
      if (arr[i] > arr[j]) inversions++;
  int minv = inversions, pairs = 0;
  for (int i = 0; i < n - 1; i++)
    for (int j = i + 1; j < n; j++) {
      int inv = inversions;
      inv = inv + 2 * dp[i][j] - 2 * dp[j][i + 1] - 1;
      if (inv < minv) {
        minv = inv;
        pairs = 1;
      } else if (inv == minv)
        pairs++;
    }
  cout << minv << " " << pairs << endl;
  return 0;
}
