#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, A[5001];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> A[i];
  vector<int> C[5001];
  for (int i = 0; i < n; i++) {
    C[i].reserve(n);
    fill_n(C[i].begin(), n, 0);
  }
  for (int i = 0; i < n; i++) {
    for (int j = i - 1; j >= 0; j--) {
      if (A[j] < A[i])
        C[i][j] = C[i][j + 1] + 1;
      else
        C[i][j] = C[i][j + 1] - 1;
    }
    for (int j = i + 1; j < n; j++) {
      if (A[j] < A[i])
        C[i][j] = C[i][j - 1] - 1;
      else
        C[i][j] = C[i][j - 1] + 1;
    }
  }
  int m = 1000000000, cnt;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (C[i][j] + C[j][i] + 1 < m) {
        m = C[i][j] + C[j][i] + 1;
        cnt = 1;
      } else if (C[i][j] + C[j][i] + 1 == m) {
        cnt++;
      }
    }
  }
  int cntInv = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (A[i] > A[j]) cntInv++;
  cout << cntInv + m << " " << cnt << endl;
  return 0;
}
