#include <bits/stdc++.h>
int a[5001];
int f[5001][5001];
int g[5001][5001];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int x = 1; x <= n; ++x)
    for (int i = x + 1; i <= n; ++i)
      if (a[x] > a[i])
        f[x][i] = f[x][i - 1] - 1;
      else
        f[x][i] = f[x][i - 1] + 1;
  for (int x = 1; x <= n; ++x)
    for (int i = x - 1; i >= 1; --i)
      if (a[x] > a[i])
        g[x][i] = g[x][i + 1] + 1;
      else
        g[x][i] = g[x][i + 1] - 1;
  int minn = 9999999, minc = 0;
  for (int s = 1; s <= n - 1; ++s)
    for (int e = s + 1; e <= n; ++e) {
      int count = f[s][e - 1] + g[e][s + 1];
      if (a[s] > a[e])
        --count;
      else
        ++count;
      if (count < minn) {
        minn = count;
        minc = 1;
      } else if (count == minn)
        ++minc;
    }
  int sum = 0;
  for (int i = 1; i <= n - 1; ++i)
    for (int j = i + 1; j <= n; ++j)
      if (a[i] > a[j]) ++sum;
  printf("%d %d\n", sum + minn, minc);
}
