#include <bits/stdc++.h>
using namespace std;
int a[5000], b[5000][2], n, minn, l, m, t, maxx, kol, mx;
vector<int>::iterator k;
vector<int> temp;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  temp.push_back(a[0]);
  for (int i = 1; i < n; i++) {
    k = lower_bound(temp.begin(), temp.end(), a[i]);
    b[i][0] = temp.size() - (k - temp.begin());
    temp.insert(k, a[i]);
    mx += b[i][0];
  }
  minn = mx;
  for (int i = 1; i < n; i++) {
    m = 0;
    l = b[i][0];
    for (int j = 0; j < i; j++) {
      if (a[i] < a[j]) {
        b[j][1]++;
        m++;
        t = mx - b[i][0] + (m - 1) + (i - j - b[j][1]) - (b[j][1] - 1) +
            (i - j - l);
        if (t < minn) {
          kol = 1;
          minn = t;
        } else if (t == minn)
          kol++;
        l--;
      }
    }
  }
  cout << minn << " " << kol << endl;
  return 0;
}
