#include <bits/stdc++.h>
using namespace std;
const bool debug = false;
template <class T>
inline ostream& operator<<(ostream& out, vector<T> v) {
  out << "[";
  int i, n = v.size();
  for (i = 0; i < n; i++) out << " " << v[i];
  return out << " ]";
}
template <class S, class T>
inline ostream& operator<<(ostream& out, pair<S, T> pp) {
  return out << "{ " << pp.first << ", " << pp.second << " }";
}
int main() {
  if (debug) freopen("aa.in", "r", stdin);
  int n;
  cin >> n;
  vector<int> v(n);
  vector<vector<int> > dp(n, vector<int>(n));
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n; i++) {
    for (int j = i - 1; j >= 0; j--) dp[i][j] = dp[i][j + 1] + (v[j] > v[i]);
    for (int j = i + 1; j < n; j++) dp[i][j] = dp[i][j - 1] + (v[j] > v[i]);
  }
  if (debug)
    cout << "[ "
         << "v"
         << " => " << v << " ]" << endl;
  for (int i = 0; i < n; i++)
    if (debug)
      cout << "[ "
           << "dp[i]"
           << " => " << dp[i] << " ]" << endl;
  int best, q = 0, actual = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) actual += v[i] > v[j];
  best = actual;
  if (debug)
    cout << "[ "
         << "actual"
         << " => " << actual << " ]" << endl;
  for (int i = 0; i < n; i++)
    for (int j = i + 1, x; j < n; j++)
      if (v[i] > v[j]) {
        x = actual - 2 * (dp[j][i] - dp[i][j]) + 1;
        if (x < best) {
          best = x;
          q = 1;
        } else if (x == best) {
          q++;
        }
      }
  cout << best << " " << q << endl;
  return 0;
}
