#include <bits/stdc++.h>
using namespace std;
short dp[5003][5003];
short dp2[5003][5003];
int a[5003];
int main() {
  int n;
  int i, j;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (i = n - 1; i > -1; i--) {
    for (j = 0; j < n; j++) {
      dp[i][j] = dp[i + 1][j];
      if (i + 1 < n && a[i + 1] < j) dp[i][j]++;
    }
  }
  for (i = 1; i < n; i++) {
    for (j = 0; j < n; j++) {
      dp2[i][j] = dp2[i - 1][j];
      if (a[i - 1] > j) dp2[i][j]++;
    }
  }
  int maxi = -2000000000;
  int sum = 0;
  for (i = 0; i < n; i++) sum += (int)dp[i][a[i]];
  int coun;
  for (i = 0; i < n; i++) {
    for (j = i; j < n; j++) {
      int res = (int)dp[j][a[j]] - dp[i][a[j]] + dp[i][a[i]] - dp[j][a[i]] +
                (dp2[j][a[j]] - dp2[i][a[j]]) + (dp2[i][a[i]] - dp2[j][a[i]]);
      if (res == maxi) coun++;
      if (res > maxi) {
        maxi = res;
        coun = 1;
      }
    }
  }
  printf("%d %d\n", sum - maxi + 1, coun);
  return 0;
}
