#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
int arr[N];
int bigger[N][N], smaller[N][N];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int val = 0; val < n; val++) {
    for (int i = 0; i < n; i++) {
      bigger[val][i] = (arr[i] > val) + (i ? bigger[val][i - 1] : 0);
      smaller[val][i] = (arr[i] < val) + (i ? smaller[val][i - 1] : 0);
    }
  }
  int swaps = 0;
  for (int i = 0; i < n; i++) swaps += bigger[arr[i]][i];
  int mn = swaps, ways = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int cur = swaps;
      cur -= (bigger[arr[j]][j - 1] - bigger[arr[j]][i]);
      cur += (smaller[arr[j]][j - 1] - smaller[arr[j]][i]);
      cur += (bigger[arr[i]][j - 1] - bigger[arr[i]][i]);
      cur -= (smaller[arr[i]][j - 1] - smaller[arr[i]][i]);
      if (arr[i] > arr[j])
        cur--;
      else
        cur++;
      if (cur < mn) {
        mn = cur;
        ways = 1;
      } else if (mn == cur)
        ways++;
    }
  }
  cout << mn << " " << ways << "\n";
}
