#include <bits/stdc++.h>
using namespace std;
int n;
int arr[5010], xiao[5010][5010], da[5010][5010];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", arr + i), arr[i]++;
  int sum = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      xiao[i][j] = xiao[i][j - 1];
      if (arr[j] < arr[i]) xiao[i][j]++, sum++;
    }
  for (int j = n; j >= 1; j--)
    for (int i = j - 1; i >= 1; i--) {
      da[i][j] = da[i + 1][j];
      if (arr[j] < arr[i]) da[i][j]++;
    }
  int ma = 0, cnt = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (2 * (xiao[i][j] + da[i][j] - (j - i)) > ma)
        ma = 2 * (xiao[i][j] + da[i][j] - (j - i));
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (2 * (da[i][j] + xiao[i][j] - (j - i)) == ma) cnt++;
  printf("%d %d\n", sum - ma + 1, cnt);
}
