#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int p[n], pos[n], range_greater[n][n], range_lesser[n][n];
  for (int i(0); i < n; ++i) {
    cin >> p[i];
    pos[p[i]] = i;
  }
  int pre_ans(0);
  for (int num(0); num < n; ++num) {
    range_greater[num][0] = p[0] > num ? 1 : 0;
    for (int position(1); position < n; ++position)
      range_greater[num][position] =
          range_greater[num][position - 1] + (p[position] > num ? 1 : 0);
    pre_ans += range_greater[num][pos[num]];
    range_lesser[num][n - 1] = p[n - 1] < num ? 1 : 0;
    for (int position(n - 2); position >= 0; --position)
      range_lesser[num][position] =
          range_lesser[num][position + 1] + (p[position] < num ? 1 : 0);
  }
  int ans(1000000000), cnt(1), curr;
  for (int i(0); i < n; ++i)
    for (int j(i + 1); j < n; ++j) {
      curr = pre_ans - range_greater[p[i]][i] + range_greater[p[i]][j] -
             range_greater[p[j]][j] + range_greater[p[j]][i] -
             range_lesser[p[i]][i] + range_lesser[p[i]][j] -
             range_lesser[p[j]][j] + range_lesser[p[j]][i] -
             (p[i] > p[j] ? 1 : 0);
      if (curr < ans) {
        ans = curr;
        cnt = 1;
      } else if (curr == ans)
        ++cnt;
    }
  cout << ans << ' ' << cnt;
}
