#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
const int inf = (int)1e9 + 1;
const long long big = (long long)1e18 + 1;
const int P = 31;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-6;
const double pi = atan2(0, -1);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(20);
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int inv = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < i; j++)
      if (a[i] < a[j]) inv++;
  int diff[n][n];
  for (int i = 0; i < n; i++) {
    int curr = 0;
    for (int j = i - 1; j > -1; j--) {
      diff[i][j] = curr;
      if (a[i] < a[j])
        curr--;
      else
        curr++;
    }
    curr = 0;
    for (int j = i + 1; j < n; j++) {
      diff[i][j] = curr;
      if (a[i] < a[j])
        curr++;
      else
        curr--;
    }
  }
  int ans = 0, cnt = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      int d = diff[i][j] + diff[j][i];
      if (a[i] < a[j])
        d++;
      else
        d--;
      if (d < ans) {
        ans = d;
        cnt = 1;
      } else if (d == ans)
        cnt++;
    }
  cout << inv + ans << " " << cnt << endl;
  return 0;
}
