#include <bits/stdc++.h>
using namespace std;
const int maxN = 5000 + 5;
const int lim = 1000 * 1000 * 1000;
const int inf = 1000 * 1000 * 1000 + 5;
int a[maxN];
vector<int> v[maxN];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  v[0].push_back(a[0]);
  for (int i = 1; i < n; i++) {
    int fl = 1;
    for (int j = 0; j < v[i - 1].size(); j++) {
      if (v[i - 1][j] < a[i])
        v[i].push_back(v[i - 1][j]);
      else {
        if (fl) v[i].push_back(a[i]), fl = 0;
        v[i].push_back(v[i - 1][j]);
      }
    }
    if (fl) v[i].push_back(a[i]);
  }
  int ans = 0;
  for (int i = 0; i < n; i++)
    ans += v[i].size() - 1 -
           (lower_bound(v[i].begin(), v[i].end(), a[i]) - v[i].begin());
  int cnt = 0;
  int answer = inf;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      if (a[i] < a[j]) continue;
      int tmp = ans;
      tmp -= v[i].size() - 1 -
             2 * (lower_bound(v[i].begin(), v[i].end(), a[i]) - v[i].begin());
      tmp -= v[j].size() - 1 -
             2 * (lower_bound(v[j].begin(), v[j].end(), a[j]) - v[j].begin());
      tmp += v[i].size() -
             2 * (lower_bound(v[i].begin(), v[i].end(), a[j]) - v[i].begin());
      tmp += v[j].size() -
             2 * (lower_bound(v[j].begin(), v[j].end(), a[i]) - v[j].begin());
      if (a[i] > a[j])
        tmp--;
      else
        tmp++;
      if (tmp < answer)
        answer = tmp, cnt = 1;
      else if (tmp == answer)
        cnt++;
    }
  cout << answer << ' ' << cnt << endl;
  return 0;
}
