#include <bits/stdc++.h>
using namespace std;
int g[5500][5500];
int main() {
  int n, cnt;
  int temp;
  int arr[5500];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  for (int i = 0; i < n; i++) {
    cnt = 0;
    for (int j = n - 1; j >= 0; j--) {
      if (arr[j] < i) cnt++;
      g[i][j] = cnt;
    }
    g[i][n] = 0;
  }
  int ma = -1000000000;
  cnt = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      int a = g[arr[j]][i] - g[arr[j]][j + 1];
      int b = -g[arr[i]][i + 1] + g[arr[i]][j + 1];
      int c = j - i - 1 - (g[arr[j]][i + 1] - g[arr[j]][j + 1]);
      int d = j - i - 1 - (g[arr[i]][i + 1] - g[arr[i]][j]);
      temp = -(b + a) + c - d;
      if (temp == ma) {
        cnt++;
      } else if (temp > ma) {
        ma = temp;
        cnt = 1;
      }
    }
  int sum = 0;
  for (int i = 0; i < n; i++) sum += g[arr[i]][i + 1];
  sum -= ma;
  printf("%d %d\n", sum, cnt);
  return 0;
}
