#include <bits/stdc++.h>
int p[5001][5001];
int q[5001];
int i, j, n, m;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &j);
    p[i][++j] = 1;
    q[i] = j;
  }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++)
      p[i][j] += p[i - 1][j] + p[i][j - 1] - p[i - 1][j - 1];
  int ans = 0, now = -1, temp, c = 0;
  for (i = 1; i <= n; i++)
    for (j = i + 1; j <= n; j++) {
      if (q[i] > q[j]) {
        ans++;
        temp = p[j][q[i]] + p[i - 1][q[j] - 1] - p[i - 1][q[i]] -
               p[j][q[j] - 1] - 2;
        if (temp > now) {
          now = temp;
          c = 1;
        } else if (temp == now) {
          c++;
        }
      }
    }
  if (now < 0) {
    printf("%d %d\n", 1, n - 1);
  } else
    printf("%d %d\n", ans - 2 * now - 1, c);
  return 0;
}
