#include <bits/stdc++.h>
using namespace std;
int n, a[5001], cnt1[5001][5001], cnt2[5001][5001], x = 0, ans = (1 << 29),
                                                    u = 0;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++)
    for (int j = n - 1; j >= 1; j--)
      cnt1[i][j] = cnt1[i][j + 1] + (a[i] > a[j + 1]);
  for (int i = 1; i <= n; i++)
    for (int j = n - 1; j >= 1; j--)
      cnt2[i][j] = cnt2[i][j + 1] + (a[i] < a[j + 1]);
  for (int i = 1; i <= n; i++) x += cnt1[i][i];
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      int y = cnt1[i][j] - cnt1[i][i] + cnt2[i][i] - cnt2[i][j];
      int z = cnt1[j][i] - cnt1[j][j] + cnt2[j][j] - cnt2[j][i] - (a[i] < a[j]);
      if (ans > x + y + z)
        ans = x + y + z, u = 1;
      else if (ans == x + y + z)
        u++;
    }
  printf("%d %d\n", ans, u);
  return 0;
}
