#include <bits/stdc++.h>
using namespace std;
vector<int> a;
int innow = 0;
void merge(int l, int m, int r) {
  int it1 = 0;
  int it2 = 0;
  vector<int> t(r - l);
  while (it1 + it2 < r - l) {
    if ((m + it2 == r || a[l + it1] < a[m + it2]) && l + it1 < m) {
      t[it1 + it2] = a[l + it1];
      ++it1;
    } else {
      t[it1 + it2] = a[m + it2];
      innow += m - (l + it1);
      ++it2;
    }
  }
  for (int i = 0; i < r - l; i++) {
    a[i + l] = t[i];
  }
}
void merge_sort(int l, int r) {
  if (r - l <= 1) {
    return;
  }
  int m = (r + l) / 2;
  merge_sort(l, m);
  merge_sort(m, r);
  merge(l, m, r);
}
int main() {
  int n;
  cin >> n;
  a.resize(n);
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    v[i] = a[i];
  }
  merge_sort(0, n);
  vector<vector<int>> dpma(n, vector<int>(n));
  vector<vector<int>> dpmi(n, vector<int>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      dpma[i][j] = (i > 0 ? dpma[i - 1][j] : 0) + (v[i] > j);
      dpmi[i][j] = (i > 0 ? dpmi[i - 1][j] : 0) + (v[i] < j);
    }
  }
  vector<int> ki(15e6);
  int ans = 1e8 + 7;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      if (v[i] < v[j]) continue;
      int in = innow - dpmi[j - 1][v[i]] + dpmi[i][v[i]] + dpma[j - 1][v[i]] -
               dpma[i][v[i]] - dpma[j - 1][v[j]] + dpma[i][v[j]] +
               dpmi[j - 1][v[j]] - dpmi[i][v[j]] - 1;
      ans = min(ans, in);
      ki[in]++;
    }
  }
  cout << ans << " " << ki[ans];
}
