#include <bits/stdc++.h>
using namespace std;
int a[5000], b[5000][5000], n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      b[i][j] = -1;
    }
  }
  for (int i = 0; i < n; i++) {
    b[i][i] = 0;
    for (int j = 0; j < i; j++) {
      if (a[i] < a[j]) {
        b[i][i]++;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = i - 1; j >= 0; j--) {
      b[i][j] = b[i][j + 1];
      if (a[j] > a[i]) {
        b[i][j]--;
      }
    }
    for (int j = i + 1; j < n; j++) {
      b[i][j] = b[i][j - 1];
      if (a[j] > a[i]) {
        b[i][j]++;
      }
    }
  }
  int ans = 0;
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int x = 2 * (b[i][j] - b[i][i] + b[j][i] - b[j][j]) -
              (a[i] < a[j] ? 1 : 0) + (a[i] > a[j] ? 1 : 0);
      m[x]++;
      ans = min(ans, x);
    }
  }
  int counter = 0;
  for (int i = 1; i < n; i++) {
    int j = i;
    while (j > 0 && a[j] < a[j - 1]) {
      swap(a[j], a[j - 1]);
      counter++;
      j = j - 1;
    }
  }
  cout << counter + ans << " " << m[ans] << endl;
  return 0;
}
