#include <bits/stdc++.h>
using namespace std;
int n, a[5002], lf[5002][5002], rf[5002][5002], inv;
void fun() {
  for (int i = 0; i < n; i++) {
    int cnt = 0;
    for (int j = i - 1; j >= 0; j--) {
      if (a[j] > a[i]) cnt++;
      lf[i][j] = cnt;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    int cnt = 0;
    for (int j = i + 1; j < n; j++) {
      if (a[j] < a[i]) cnt++;
      rf[i][j] = cnt;
    }
  }
}
int sp(int i, int j) {
  int z = -lf[i][j] - rf[j][i] + (i - j - lf[i][j]) + (i - j - rf[j][i]);
  if (a[i] < a[j]) z++;
  return inv + z;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < i; j++)
      if (a[j] > a[i]) inv++;
  int pos[n];
  for (int i = 0; i < n; i++) pos[a[i]] = i;
  fun();
  int mn = 100000000000000000, cnt = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i != j && pos[i] > pos[j]) {
        int small_pp = sp(pos[i], pos[j]);
        if (small_pp < mn) {
          mn = small_pp, cnt = 1;
        } else if (small_pp == mn) {
          cnt++;
        }
      }
    }
  }
  cout << mn << " " << cnt;
}
