#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> seq(n);
  for (int i = 0; i < n; i++) cin >> seq[i];
  int total = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (seq[i] > seq[j]) total++;
  vector<vector<int> > smaller(n, vector<int>(n, 0));
  vector<vector<int> > larger(n, vector<int>(n, 0));
  for (int i = 1; i < n; i++)
    for (int j = n - 2; j >= 0; j--) {
      smaller[i][j] = smaller[i][j + 1];
      if (seq[j + 1] < i) smaller[i][j]++;
    }
  for (int i = 0; i < n - 1; i++)
    for (int j = 1; j < n; j++) {
      larger[i][j] = larger[i][j - 1];
      if (seq[j - 1] > i) larger[i][j]++;
    }
  int count = 0, value = 1000000000;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      if (seq[i] > seq[j]) {
        int nvalue = total;
        nvalue += smaller[seq[i]][j] - smaller[seq[i]][i];
        nvalue += smaller[seq[j]][i] - smaller[seq[j]][j];
        nvalue += larger[seq[i]][j] - larger[seq[i]][i];
        nvalue += larger[seq[j]][i] - larger[seq[j]][j];
        if (nvalue + 1 == value)
          count++;
        else if (nvalue + 1 < value)
          value = nvalue + 1, count = 1;
      }
    }
  cout << value << " " << count;
  return 0;
}
